johnseito Posted February 17, 2008 Share Posted February 17, 2008 Hello all, People say that this code is suppose to work: while($row = mysql_fetch_array($query)) { echo "<tr>"; echo "<td><img src =\"" . $row['user_image']."\"></td>"; echo "</tr>"; it should bring out all your images/photo. I tried this code and no photo appear, just the icon, and when you upload one photo it seems that 3 icon will pop out as if there is 3 photo for every upload. but when I do it like this, Code: $row = mysql_fetch_assoc($query); $bytes = $row[imgdata]; $row = mysql_fetch_assoc($query); $bytes = $row[imgdata]; <center><img src=?gim=1 width=1000 height=1000><br> <!--144--> it works but it only brings out one photo. I want it to bring out all photo, imgdata is the field in mysql that stores the pictures. any help would be great. thankst Link to comment https://forums.phpfreaks.com/topic/91530-display-images/ Share on other sites More sharing options...
Chris92 Posted February 17, 2008 Share Posted February 17, 2008 Your code should work, just make sure you are getting the right field. Link to comment https://forums.phpfreaks.com/topic/91530-display-images/#findComment-468834 Share on other sites More sharing options...
Barand Posted February 17, 2008 Share Posted February 17, 2008 it will work if the data is a filename, but not if the data is a blob containing the image data Link to comment https://forums.phpfreaks.com/topic/91530-display-images/#findComment-468838 Share on other sites More sharing options...
johnseito Posted February 17, 2008 Author Share Posted February 17, 2008 Ok, thanks for your response. I created a table in MySQL called pix like this: Create table pix ( Pid int primary key not null auto_increment, Title text, Imgdata longblob); I know how to store the photo correctly into the pix table, but I couldn’t get all the uploaded photo out. I could only get one, the lastest one uploaded. And I couldn’t upgrade the code to do just that because of this: if ($_REQUEST[gim] == 1) { header("Content-type: image/jpeg"); print $bytes; exit (); } <img src=?gim=1 width=1000 height=1000><br> The gim==1 is what determines the photo to appear. I don’t know why is it gim ==1. So could you tell me why is src gim =1 or how I can change this code to show all photo uploaded instead of just 1. Thanks - Link to comment https://forums.phpfreaks.com/topic/91530-display-images/#findComment-468873 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.