Dreadful headers already sent!
Posted: Tue Apr 01, 2008 6:47 am
Well, this project has given me more problems than i bargained for, but i think once i get the headers already sent out of the way, it will be a straight road too home for me!
AS you can hear, its a headers already sent issue!
Heres the deal. I have images which is directly uploaded into the database. I prefer it this way. Obviously to view it, you must add a header(\"Content-type:image/jpeg\"); but if i add that too my code i get headers already sent and bam, the image goes all funky on me!
Can someone please logically explain to me why this is happening, possible causes and what i am doing wrong. Here is my code:
AS you can hear, its a headers already sent issue!
Heres the deal. I have images which is directly uploaded into the database. I prefer it this way. Obviously to view it, you must add a header(\"Content-type:image/jpeg\"); but if i add that too my code i get headers already sent and bam, the image goes all funky on me!
Can someone please logically explain to me why this is happening, possible causes and what i am doing wrong. Here is my code:
Code: Select all
$sql = mysql_query("SELECT * FROM bushshirts");
while($row = mysql_fetch_array($sql))
{
// get variables
$name = $row['name'];
$img = $row['img'];
$id = $row['id'];
$description = $row['description'];
echo"
header(\"Content-type:image/jpeg\");
<table bgcolor='red' border='1px' width='400px'>
<tr>
<td width='100px'>$name</td>
<td width='100px'>$img</td>
<td width='100px'>$id</td>
<td width='100px'>$description</td>
</tr>
</table><br>";
}
?>