Making a new row in HTML tables
| From: | Ian Grant | Date: | Wed, 25 Jul 2001 15:54:07 +0000 |
| Subject: | Making a new row in HTML tables | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-10752@lists.php.net to get a copy of this message | ||
Hi,
Can anyone help me with this - I have a database of people, that I want to
print into an HTML table - how can I make the table wrap into an equal
number of rows.
i.e. if there are 4 entries, a 2x2 table, 6 a 2x3, 8 a 2x4, 9 a 3x3, etc.
At the moment, I have something like:
$rows=mysql_num_rows($result);
$i=1;
while ($array = mysql_fetch_array($result)) {
print ("<td
align=\"center\">".$array["Image"]."><br>".$array["Name"]."</td>\n");
if (is_int($rows / $i)) {
print ("</tr>\n<tr>");
}
$i++;
}
Thanks,
Ian.
--