Jump to content

[SOLVED] how to retrieve image(BLOB) from mysql database


suma237

Recommended Posts

could you please check this code

#connecting to mysql server
$link = mysql_connect(MyHost,MyUser,MyPass) or die("Error while connecting".mysql_error());
mysql_select_db(MyDataBase);


$fetch_id="select id from tbl_images";
$result_id=mysql_query($fetch_id);
while($row_fetchid=mysql_fetch_array($result_id))
	{
	$id1=$row_fetchid['id'];
   $fetch_query="select image,imagename from tbl_images where id=".$id1;
        $result=mysql_query($fetch_query);
                $row_fetch=mysql_fetch_assoc($result);
                print "Image Name:".$row_fetch['imagename'];

        $image_disp=$row_fetch['image'];
	header("Content-type:image/jpeg");
      	print $image_disp;
	}

[code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.