iandotcom Posted August 18, 2008 Share Posted August 18, 2008 I'm looping the results of a MySQL query which displays the 9 most recent records in the table. When I'm printing it though, I need to change the output though for every third iteration in the loop, to change the HTML that is outputted when it is printed. Its to keep the design looking correctly. How would I go about this? Heres the code if your a bit stumped on what I mean: <?php $RecentQuery = mysql_query("SELECT * FROM `blog` LIMIT 0 , 9"); while($Recent = mysql_fetch_array($RecentQuery, MYSQL_ASSOC)){ ?> // Outputted HTML code goes here <?php } ?> Cheers -- Ian. Quote Link to comment Share on other sites More sharing options...
Jabop Posted August 18, 2008 Share Posted August 18, 2008 $x=0; while() { if ($x%3==0) { echo "<br />"; } $x++; } Quote Link to comment Share on other sites More sharing options...
iandotcom Posted August 18, 2008 Author Share Posted August 18, 2008 How do I adapt the code to my problem, I'm not too familiar with this part of PHP.. Quote Link to comment 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.