--- why do u want to know? <[EMAIL PROTECTED]> wrote:

> <?
> 
> 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;
> ?>

The first problem is not a show-stopper on all systems but can cause your
script to work on some but not others.  You should use the XML-style PHP tags:
<?php and ?>

Second, for this script you cannot mix text output with the binary image data. 
You have to do one or the other.  Hence, these lines are breaking your script
as far as the browser is concerned:

> echo "<h1> am here</h1>";
> echo "<h6>$contenttype</h6>";

Third, I have found it more reliable to end the value in the header() function
with two linefeed characters:

header("Content-type:$contenttype\n\n");

James
who is not afraid to reveal his name

Reply via email to