I am trying to play a wav file from a mysql database. I know it works because I can download it and then play it but I want to embed it like this:
<?
session_start();
$phone = $_SESSION['sessphone'];
if ($debug==true) {
echo "Listing messages for $person";
}
if (isset($_SESSION['loggedin'])) {
echo "Messages for $phone<br>";
$connect = mysql_connect("localhost","user","password");
$db = mysql_select_db("voicemail",$connect) or die (mysql_error());
$sql = "select * from binary_data_files where user = $phone";
$result = mysql_query($sql,$connect) or die (mysql_error());
while($row = mysql_fetch_array($result)) {
//echo "<a href='listen.php?id=$row[0]'>$row[7] $row[2] $row[8] $row[3]</a><img src="PicName.gif" border="5" align="middle"></a>
echo "<EMBED src='listen.php?id=$row[0]' autostart='false' hidden='true' loop='0'><br>";
}
}
?>
my listen.php looks like this:
<?
$connect = mysql_connect("localhost","user","password");
$db = mysql_select_db("voicemail",$connect) or die (mysql_error());
$sql = "select * from binary_data_files where file_id = '$id'";
$result = mysql_query($sql,$connect) or die (mysql_error());
while($row = mysql_fetch_array($result)) {
$type=$row[5];
$size=$row[4];
$name=$row[3];
$data=$row[1];
}
//$mycontent="Content-type: $type";
//die($mycontent);
header("Content-type: $type");
header("Content-length: $size");
header("Content-Disposition: attachment; filename=$name.$user");
header("Content-Description: PHP Generated Data");
echo stripslashes($data);
?>
How can I embed these?
--John
P.S. I am also not against opening up a new window and playing it there.