Cannot modify header information
Posted: Wed Jan 17, 2007 11:29 am
feyd | Please use
I've commented out the echo's above, but my problem clearly lies with the header call. The script is supposed to display a BLOB image from a mySql DB, but I don't understand what I'm doing wrong with the header.
Your help is highly appreciated!

feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi there, all!
Just a supposedly simple question on the header function; I keep on getting the following error in my code:
Cannot modify header information - headers already sent by...
My code is as follows:Code: Select all
while($row = mysql_fetch_assoc($banners))
{
if($row["Image"] != NULL)
{
header("Content-type: image/jpeg"); PROBLEM LIES HERE
echo("<a href=\"" . $row["URL"] . "\" target=\"_blank\">" .
"<img src=\"" .$row["Image"] . "\"></img></a><br>");
}
else
{
echo("<a href=\"" . $row["URL"] . "\" target=\"_blank\">" .
"<img src=\"" .$row["ImageURL"] . "\"></img></a><br>");
}
}Your help is highly appreciated!
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]