refiking Posted June 26, 2009 Share Posted June 26, 2009 I want to display 5 results per row, but I'm not sure how do that. Right now, all of the rows are displayed one per row. Here's what I have so far: <table> <tr> <? while ($row = mysql_fetch_assoc($sql)){ Echo '<td width="20%">' . $row['trapset'] . '</td>'; } ?> </tr> </table> Link to comment https://forums.phpfreaks.com/topic/163754-solved-multiple-records-on-a-row/ Share on other sites More sharing options...
dzelenika Posted June 26, 2009 Share Posted June 26, 2009 <table> <tr> <? $i = 0; while ($row = mysql_fetch_assoc($sql)){ if($i % 5 == 0) { echo "</tr><tr>"; } $i++; Echo '<td width="20%">' . $row['trapset'] . '</td>'; } ?> </tr> </table> Link to comment https://forums.phpfreaks.com/topic/163754-solved-multiple-records-on-a-row/#findComment-864035 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.