Thankyou sir ....and nothing special behind that name ...actually that is my yahoo subid.....so i chosen name lik that there ,
my name is sanjeev rohila and i am fresher i just started my career with php i am an MCA. ----- Original Message ----- From: James Keeline To: [email protected] Sent: Thursday, October 04, 2007 5:50 PM Subject: Re: [php-list] error in display image on browser --- 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 [Non-text portions of this message have been removed]
