display results in table
Posted: Tue Sep 26, 2006 10:55 pm
I want to generate a page of photos from my database.
I will have code similar to:
Then I want it to create a table with 4 cells in each row, once there have been 4 <td>(image)</td>'s, go to the next row (<tr>) and repeat.
I assume it will start with something like:
So what would the code be that controls the maximum of 4 <td>'s and a <tr> at the beginning and </tr> at the end, then going to a new <tr>?
Thanks in advance, I googled and found nothing.
-Steve
I will have code similar to:
Code: Select all
$result = mysql_query("SELECT * FROM photos WHERE global_id='$_GET['id']'") or die(mysql_error());
$num_rows = mysql_num_rows($result);
$row = mysql_fetch_array($result);I assume it will start with something like:
Code: Select all
$i = 0;
while($i < $num_rows) {
//some code here to display first <tr> then 4 <td></td>'s, then the end </tr>, then repeat
}Thanks in advance, I googled and found nothing.
-Steve