| Start a new table row in a loop
|
matthewamzn

msg:3748318 | 11:45 pm on Sep 19, 2008 (gmt 0) | I want to make a table that has three columns. In my query I'm pulling out all the images and placing them each inside a table cell. How can I tell it to start a new row after the third image has been pulled. <table> <?php while ($row = mysql_fetch_array($result)) { echo "<td><an image></td>"; } ?> </table>
|
Anyango

msg:3748430 | 5:22 am on Sep 20, 2008 (gmt 0) | <table> <?php $nextColumn=1; echo "<tr>"; while ($row = mysql_fetch_array($result)) { echo "<td><an image></td>"; $nextColumn++; if($nextColumn>3) { echo "<tr>"; $nextColumn=1; } } ?> </table>
[edited by: Anyango at 5:24 am (utc) on Sep. 20, 2008]
|
|
|