That's your answer is it? :-)
When you query a database you get a list of results.
But when you want to print two columns, you need to be able to print
two results at the same time.
You want to print one column that contains the first half of the list, and one column that contains the second half.
But in HTML you can only print complete rows, and each row must contain all columns.
So you need a way to get data from the first AND the second half at the same time.
There are two ways of doing it.
One: fetch all the data into an array and print the elements:
in untested pseudo code:
do query
check for results
$result_array=array()
while ($row=mysql_fetch_array($result,MYSQL_ASSOC))
{
$result_array[]=$row;
};
Now you have all your results in $result_array, time to print them
echo '<table>';
$total_results=count($result_array);
Find out how many results there are in the first half
(the second half will be either the same length, or one less)
the second half will begin at this point
$halfway_point = ceil($total_results/2);
Print the rows
for ($t=0;$t<count($result_array)/;$t++)
{
echo '<tr>';
first column, print the item from the first half
echo '<td>'.$result_data[$t].'</td>';
second column, print the item from the second half
echo '<td>'.$result_data[$t + $halfway_point].'</td>';
echo '</tr>';
};
echo '</table>';
I suggest you try it out with simple hand-made array's first, to get a feel of how it works before you start messing with the database data (it's easier to see what happens if you know which data should be at every location)
The other way is much the same, but uses PHP's mysql_data_seek() to move to the correct location in the resultset, so instead of using an array to store the data, you jump to the location in the dataset and fetch the data just before you print it. That saves a little memory, but requires many many more operations.