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. Link to comment https://forums.phpfreaks.com/topic/120236-sorta-complicated-while-loop/ 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++; } Link to comment https://forums.phpfreaks.com/topic/120236-sorta-complicated-while-loop/#findComment-619373 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.. Link to comment https://forums.phpfreaks.com/topic/120236-sorta-complicated-while-loop/#findComment-619548 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.