RE: [PHP] TABLE COLUMNS
| From: | Don Read | Date: | Mon, 02 Jun 2003 08:46:57 +0000 |
| Subject: | RE: [PHP] TABLE COLUMNS | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-149771@lists.php.net to get a copy of this message | ||
On 02-Jun-2003 Ralph wrote:
> I'm querying a database then printing the results in a <TABLE>. What I
> want to do is format the results in a <TABLE> with 4 columns per row.
> Any suggestions?
>
> Thanks.
>
$modulo=4;
unset($a);
echo "\n<table>";
while($row = $r->FetchRow()) {
if (count($a) >= $modulo) {
echo "\n <tr><td>", implode('</td><td>',
$a), '</td></tr>';
unset($a);
}
$a[]=$row['blah'] .' ' .$row['foo'];
}
while (count($a) < $modulo) {
$a[]=' ';
}
echo "\n <tr><td>", implode('</td><td>', $a),
'</td></tr>';
echo "\n</table>\n";
Regards,
--
Don Read dread@texas.net
-- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.