graham23s Posted November 21, 2007 Share Posted November 21, 2007 Hi Guys, I let the users on my site upload 10 images each, when it comes to showing the images they all show horizobtally down the way i was after: img1 img 2 img 3 img 4 img 5 img 6 img 7 img 8 img 9 img 10 what would be the best way to acomplish this do you think? <?php ################################################# # viewimages.php ################################################# ## id $usersid = $_GET['id']; $qi = "SELECT * FROM `usersphotos` WHERE `userid`='$usersid' ORDER BY `date`"; $ri = mysql_query($qi); $anyimages = mysql_num_rows($ri); ## echo a back link echo ("<div id=\"\" align=\"left\">[<a href=\"profile.php?id=$usersid\" class=\"foot_links\">Back To Users Profile</a>]</div>"); ## no uploads if($anyimages == 0) { stderr("Error","This user has no images uploaded yet."); include("includes/footer.php"); exit; } ## loop the images out while($r = mysql_fetch_array($ri)) { $imageid = $r['id']; $image = $r['image']; echo ("<table class=\"sub_table\" align=\"center\" width=\"250\" border=\"0\" cellpadding=\"5\" cellspacing=\"0\">"); echo ("<tr>"); echo ("<td class=\"header_boxes\" align=\"center\"><span class=\"prof_head\">Image ID [$imageid]</span></td>"); echo ("</tr>"); echo ("<tr>"); echo ("<td bgcolor=\"#e8f1fa\" align=\"center\"><img src=\"uploads/$image\"></td>"); echo ("</tr>"); echo ("<tr>"); echo ("<td bgcolor=\"#e8f1fa\" align=\"center\"> </td>"); echo ("</tr>"); echo ("</table><br />"); } ?> thanks guys Graham Link to comment https://forums.phpfreaks.com/topic/78217-displaying-images/ Share on other sites More sharing options...
MadTechie Posted November 21, 2007 Share Posted November 21, 2007 This isn't a PHP question.. its HTML/CSS question.. the problem is with your table.. don't loop the table over and over.. just the columns ie <?php ## loop the images out $TDimages =""; $TDimagedata =""; while($r = mysql_fetch_array($ri)) { $imageid = $r['id']; $image = $r['image']; $TDimages .= "<td bgcolor=\"#e8f1fa\" align=\"center\"><img src=\"uploads/$image\"></td>" $TDimagedata .= "<td class=\"header_boxes\" align=\"center\"><span class=\"prof_head\">Image ID [$imageid]</span></td>"; } echo ("<table class=\"sub_table\" align=\"center\" width=\"250\" border=\"0\" cellpadding=\"5\" cellspacing=\"0\">"); echo ("<tr>"); echo ($TDimages); echo ("</tr>"); echo ("<tr>"); echo ($TDimagedata); echo ("</tr>"); echo ("<tr>"); echo ("<td bgcolor=\"#e8f1fa\" align=\"center\"> </td>"); echo ("</tr>"); echo ("</table><br />"); ?> (UNTESTED unchecked) Link to comment https://forums.phpfreaks.com/topic/78217-displaying-images/#findComment-395818 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.