Retreiving images from database
Posted: Mon Apr 13, 2009 6:44 am
This is my first attempt at retrieving an image from a database
It prints the address of the page i.e. http://localhost/index.php
It makes the page: title index.php (JPEG image)
Can anyone explain what is going on?
Code: Select all
<?
header("Content-type: image/jpeg");
mysql_connect("localhost","root","xxxxx");
mysql_select_db("test");
$mysql ="SELECT imgdata".
"FROM pix ".
"WHERE pid = 14 ";
if ($row = mysql_fetch_assoc($mysql)) {
$bytes = $row[imgdata];}
print $bytes;
?>It makes the page: title index.php (JPEG image)
Can anyone explain what is going on?