How about working out the length of the column (by dividing the number of
rows by the number of cols you want), dump your results into an array and
using the col length as an offset to pick through the resulting table?

// $data is an array of results

$rows = count ($data)
$row_len = round ($rows / 3); // three cols

print "<table>";
for ($i = 0; $i < $row_len; $i++)
{
    print "<tr>";
    print "<td>".$data[$i]."</td>";
    print "<td>".($row_len + $i < $rows)?$data[$row_len +
$i]:"&nbsp;"."</td>";
    print "<td>".((2 * $row_len) + $i < $rows)?$data[(2 * $row_len) +
$i]:"&nbsp;"."</td>";
    print "</tr>"
}
print "</table>";

This is off the cuff code and I think the row length's might need some extra
checking, but sth like this should work... (crosses fingers)

Mikey



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

Reply via email to