The image can not be displayed because it contains errors

advertisements
<?php
//include database connection
include("include/db.php");

//select the image
$query = "SELECT image FROM fresult WHERE result_id = 1";

$result = mysql_query($query) or die('SQL error');

while($row1 = mysql_fetch_array($result, MYSQL_ASSOC))
{

    header("Content-type: image/jpg");

    //display the image data
    print $row1['image'];
    //exit;
}

?>

What is wrong with this code? I don't understand.

I try to do simple code to retrieve the image. I use xampp, SQL blob.


From what I see, it looks like all you have to do is switch your header to read:

header("Content-type: image/jpeg");

image/jpg isn't a content-type header.

If you post the image data in a comment, I might be able to be of more assistance.

Hope this helps.

php mysql jpeg db