juanc Posted July 6, 2006 Share Posted July 6, 2006 Hi I’m trying to display some thumbnail images I have via a mysql query.The problem I have though is in trying to achieve a certain layout.I want a row of three individual items then another three underneath and so on. basically a replica of this…… http://www.templatemonster.com/category.php?type=0&tid=+-+Any+-&search_words=+-+Any+-&from_=&to=&cat=57&style=0&author=0&x=24&y=8What I’ve always been used to in the past is outputting one item per row, where as this would be three database rows in one html table row. is there possibly abit of code that could put in a line break each time three items are displayed.while($row = mysql_fetch_array($query)) { // abit of code here to put in a line break after 3 items echo row[‘item’]; }Or perhaps someone could suggest another way. Quote Link to comment https://forums.phpfreaks.com/topic/13845-a-layout-issue-from-a-mysql-query/ Share on other sites More sharing options...
wildteen88 Posted July 6, 2006 Share Posted July 6, 2006 Have a read of [url=http://www.phpfreaks.com/forums/index.php/topic,95443.0.html]this FAQ thread[/url] it should be able to help. Quote Link to comment https://forums.phpfreaks.com/topic/13845-a-layout-issue-from-a-mysql-query/#findComment-53875 Share on other sites More sharing options...
.josh Posted July 6, 2006 Share Posted July 6, 2006 [code]<?php $count = 0; while ($row = mysql_fetch_array($query)) { if ($count == 3) { //do your line break $count = 0; } echo row['item']; $count++; }?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/13845-a-layout-issue-from-a-mysql-query/#findComment-53878 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.