can't display image from database

stelios

Guppy
Hello,

I have uploaded some pictures in my database, but when I retrieve them they are not displayed. The rest of the information is well appeared.

This is my image.php file:
PHP:
<?php

include ('dbconnect.php');
$db = connect();
$id=$_REQUEST['id'];
$stmt = $db->query('select name,type,content from upload where id='.$id);
foreach($stmt as $row)
{
echo $row['name'].' '.$row['type'];
	
$imagebytes = $row['content'];

header("Content-type: ". $row['type']);

print $imagebytes;

}

?>

and then in my html i call it by:
<img src="image.php?id=1">

Where is my mistake? Thanks in advance
 
Back
Top