suma237 Posted February 17, 2009 Share Posted February 17, 2009 how to retrieve image(BLOB) from mysql database? Link to comment https://forums.phpfreaks.com/topic/145532-solved-how-to-retrieve-imageblob-from-mysql-database/ Share on other sites More sharing options...
Mchl Posted February 17, 2009 Share Posted February 17, 2009 1. SELECT it 2. Set up headers according to image type 3. Echo blob Link to comment https://forums.phpfreaks.com/topic/145532-solved-how-to-retrieve-imageblob-from-mysql-database/#findComment-764050 Share on other sites More sharing options...
suma237 Posted February 17, 2009 Author Share Posted February 17, 2009 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] Link to comment https://forums.phpfreaks.com/topic/145532-solved-how-to-retrieve-imageblob-from-mysql-database/#findComment-764051 Share on other sites More sharing options...
Mchl Posted February 17, 2009 Share Posted February 17, 2009 print "Image Name:".$row_fetch['imagename']; You can not echo (or print) anything else. Link to comment https://forums.phpfreaks.com/topic/145532-solved-how-to-retrieve-imageblob-from-mysql-database/#findComment-764052 Share on other sites More sharing options...
suma237 Posted February 17, 2009 Author Share Posted February 17, 2009 ok.but the loop is not working.It will display only one record. why? Link to comment https://forums.phpfreaks.com/topic/145532-solved-how-to-retrieve-imageblob-from-mysql-database/#findComment-764055 Share on other sites More sharing options...
Mchl Posted February 17, 2009 Share Posted February 17, 2009 You can't display multiple images this way. This wouldn't make any sense. Link to comment https://forums.phpfreaks.com/topic/145532-solved-how-to-retrieve-imageblob-from-mysql-database/#findComment-764058 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.