I'd just dump all of the results into an array and do something like this:

echo "<table border=1>\n";
for($i=0; $i<count($array);)
{
    echo "\t<tr>\n";
    for($j=0; $j<2; $j++)
    {
        echo "\t\t<td>".$array[$i]."</td>\n";
        $i++;
    }
    echo "\t</tr>\n";
}
echo "</table>\n";

On odd numbered arrays you'll end up with an empty cell.  Most browsers will
handel the empty cell by simply not displaying it.  Others might show the
box.  It's a minor cosmetic thing but if you want it to look consistent then
test for that situation and add a non-breaking space to the final cell.

HTH,
Kevin

----- Original Message -----
From: "phpu" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 07, 2003 4:03 PM
Subject: [PHP] Table trouble


Hello
I need help.
I'm querying a database then printing the results in a table. I want the
result to be in a table with 2 columns per row.
something like that

--------------------------------------------------------
--                        --                          --
--      row 1          --         row 2         --
--                        --                          --
--------------------------------------------------------
--                        --                          --
--      row 3          --         row 4         --
--                        --                          --
--------------------------------------------------------
--                        --                          --
--      row 5           --         row 6         --
--                        --                          --
--------------------------------------------------------
     and so on.....

How can I do that?
Please help me asap






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

Reply via email to