phpretard Posted January 20, 2008 Share Posted January 20, 2008 This seems simple enough to me BUT...there are 10 images in the database and this will only display 1 Does anyone know why? Oh please help me...(my eyeballs hurt) <?php include "connect.php"; $result = mysql_query("SELECT * FROM pictures"); while($row = mysql_fetch_array($result)) { $data = $row[bin_data]; $type = $row['file_type']; echo $data; } ?> Link to comment https://forums.phpfreaks.com/topic/86916-picture-help-please/ Share on other sites More sharing options...
cooldude832 Posted January 20, 2008 Share Posted January 20, 2008 lets try a few things to make it better <?php include "connect.php"; $result = mysql_query("SELECT * FROM pictures") or die(mysql_error()); echo "Number of images: ".mysql_num_rows($result)."<br />"; while($row = mysql_fetch_array($result)){ $data = $row[bin_data]; $type = $row['file_type']; echo $data."<br />"; } ?> Link to comment https://forums.phpfreaks.com/topic/86916-picture-help-please/#findComment-444356 Share on other sites More sharing options...
phpretard Posted January 20, 2008 Author Share Posted January 20, 2008 THANK YOU FOR RESPONDING SO QUICKLY! I can tell it is shows all of the pictures now BUT... The picture is in binary code ??? Link to comment https://forums.phpfreaks.com/topic/86916-picture-help-please/#findComment-444363 Share on other sites More sharing options...
budimir Posted January 20, 2008 Share Posted January 20, 2008 THANK YOU FOR RESPONDING SO QUICKLY! I can tell it is shows all of the pictures now BUT... The picture is in binary code ??? Of course it's in a binary mode. You did nothing to convert it back. A much better and simplier solution is that you upload all the files somwhere in dir and you store only the name of the picture in db. Link to comment https://forums.phpfreaks.com/topic/86916-picture-help-please/#findComment-444366 Share on other sites More sharing options...
phpretard Posted January 20, 2008 Author Share Posted January 20, 2008 You're right. Again thank you for the quick response Link to comment https://forums.phpfreaks.com/topic/86916-picture-help-please/#findComment-444368 Share on other sites More sharing options...
PFMaBiSmAd Posted January 20, 2008 Share Posted January 20, 2008 Every image on a web page requires its' own <img src="url" alt=""> tag. The "url" corresponds to the url that causes the image header (your posted code is not outputting any header) and image data to be output. Link to comment https://forums.phpfreaks.com/topic/86916-picture-help-please/#findComment-444412 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.