dabigchz Posted July 3, 2008 Share Posted July 3, 2008 Basically, I'd like to display each entry in my database in a table cell (a picture and name), but I can't figure out how to start a new row. My current code: while ($row = mysql_fetch_array($result)) { echo "<td align='center' width='90'>"; echo "Stuff inside table cell"; echo "</td>"; } What I'd like to do is insert a </tr><tr> after every 6th entry, to have a nice neat table. Any help would be greatly appreciated Link to comment https://forums.phpfreaks.com/topic/113069-displaying-database-entries-in-table-cells/ Share on other sites More sharing options...
ag3nt42 Posted July 3, 2008 Share Posted July 3, 2008 $x=0; while ($row = mysql_fetch_array($result)) { echo "<td align='center' width='90'>"; echo "Stuff inside table cell"; echo "</td>"; $x++; if($x==5) { echo(PHP_EOL."</tr>".PHP_EOL."<tr>".PHP_EOL) $x=0; } } that should do it Link to comment https://forums.phpfreaks.com/topic/113069-displaying-database-entries-in-table-cells/#findComment-580802 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.