By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,722 Members | 1,874 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,722 IT Pros & Developers. It's quick & easy.

How to display all images from MYSQL using PHP

selvasoft
P: 34
I want to display all images from my MYSQL database using PHP coding.The table having name,size,type,content fields. Please any one help me.

Expand|Select|Wrap|Line Numbers
  1. while($row=mysql_fetch_row($imgresult))
  2. {
  3.     header("Content-type: image/jpeg");
  4.     echo "$row[0]";
  5. }    
Am using above code to display one image from table. But i dont know to display more than one images on browser. Please any one help me.
May 2 '12 #1
Share this Question
Share on Google+
1 Reply


100+
P: 1,059
dont use this way,
write your code this way

Expand|Select|Wrap|Line Numbers
  1. while($row=mysql_fetch_row($imgresult))
  2. {
  3.     save_image_to_file($row[0],$filename);
  4.     display_image_in_htmlway($filename);
  5. }    
  6.  
May 3 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.