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'] .'&nbsp;' .$row['foo'];
    }
    while (count($a) < $modulo) {
        $a[]='&nbsp;';
    }
    echo "\n <tr><td>", implode('</td><td>', $a), '</td></tr>';
    echo "\n</table>\n";


Regards,
-- 
Don Read                                       [EMAIL PROTECTED]
-- 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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to