Tony-KM Posted July 12, 2006 Share Posted July 12, 2006 Ok I've checked on both the site and forum here for help on this but since I don't know exactly what the help is I'm looking for, I didn't really know where to look for it. Ok, here's the low-down, I've been working on an image database of sorts (to be used for free avatars, signatures, and later a simple screenshot gallery) using SQL for my site. Now, that works fine, but I'm getting the script to insert each image (avatars at the moment) into seperate cells in the table, and it causes the page to stretch nastilly once there's more than 5 cells side by side. What I need is a way to tell the script to automatically add "</tr><tr>" after every 5th entry into the table.Here's the script as it looks (so that it makes more sense, and yes I know the code is slightly messy, but meh, I'm not bothered about coding aesthetics at the moment):[code]echo "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"1\"><tr>";while ($row=mysql_fetch_array($result)){$id=$row["id"];$name=$row["name"];$artist=$row["artist"];$artisturl=$row["artisturl"];$series=$row["series"];$category=$row["category"];$date=$row["date"];$previewimage=$row["previewimage"];$download=$row["download"];$viewhtml=$row["viewhtml"];echo "<td width=\"100px\"><center><img src=\"$previewimage\" border=\"1px solid #000000\"><br>by $artist</center></td>";} echo "</tr></table><br><br><center>";[/code]And here's the code in action - http://www.ffinsight.com/index.php?icon=10Now I know I could switch the $row variable to be 5, but that means I could only display 5 avatars per page, and I want to display 25, and the page only looks right if I have 5 avatars lined next to each other. Any help on this would be greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/14418-automaticall-adding-after-so-many-sql-retrievals/ Share on other sites More sharing options...
.josh Posted July 12, 2006 Share Posted July 12, 2006 http://www.phpfreaks.com/forums/index.php/topic,100092.msg394657.html#msg394657 Quote Link to comment https://forums.phpfreaks.com/topic/14418-automaticall-adding-after-so-many-sql-retrievals/#findComment-56976 Share on other sites More sharing options...
Tony-KM Posted July 12, 2006 Author Share Posted July 12, 2006 Thank you so much! I'd kiss you if that weren't weird.I should have thought of something like that, I had to do something almost identical for a Flash project I did in university this year >.<Thanks again you've saved me much killing of people. Quote Link to comment https://forums.phpfreaks.com/topic/14418-automaticall-adding-after-so-many-sql-retrievals/#findComment-56979 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.