Always a cinch to embed php into html, but not now. I got the following code to work perfectly to successfully read a blob from a mysql db, on its own. The issue, if I put the code into any kind of html, I get hieroglyphs.
-------
<?php
$link=mysql_connect('mySer
ver','user
name','pas
sword') or die('Could not connect: ' . mysql_error());
mysql_select_db('luvjazz')
or die('Could not connect to database');
$query = "select * from upload";
$result=mysql_query($query
) or die('Query failed: ' . mysql_error());
$type;
while($line=mysql_fetch_ar
ray($resul
t,MYSQL_AS
SOC))
{
$type=$line['type'];
$data=$line['content'];
}
Header( "Content-type: $type");
echo $data;
?>
-------
This code works perfectly on its own, but not embedded into html or html embedded into it. The image gets changed into hieroglyphs. Can anyone tell me how come, and how to fix this issue?
Thanks in advance,
~ Luvjazz
Start Free Trial