----- Original Message -----
From: "why do u want to know?"
<?
mysql_connect("localhost","root","") or exit("SERVER Unavailable");
mysql_select_db(test) or exit("DB Unavailable");
$sql ="SELECT type,content FROM upload WHERE id=".$_GET["id"]." ";
echo "$sql";
$result = mysql_query($sql) or exit("QUERY FAILED!");
$contenttype = mysql_result($result,0,"type");
$image = mysql_result($result,0,"content");
echo "<h1> am here</h1>";
echo "<h6>$contenttype</h6>";
header("Content-type:$contenttype");
echo $image;
?>
while i execute this .....
the result is this instead of image
-------------------------------------------
ELECT type,content FROM upload WHERE id=3
am here
image/jpeg
�����JFIF��`�`�����C�
$.'
<snip> Absolutely!
------------------------------
Hello "why...",
Um we really don't need 100 lines of UTF8 to get the
message. We would appreciate it if you trim or "<snip>" text that is not
really that relevant.
Getting back to your bug...
The headers are (normally) sent before anything else. In fact you cannot
successfully send headers even when a single space or line feed is sent.
This is because the HTTP protocol dictates that headers are sent first and
then "\r\n\r\n" and then the page content.
So when you have an "echo()" before the "header()", the effect of the
header() function is lost.
So - do the mysql and then the headers and only then, do everything else.
Tanks, Rob.