Get some coffee, have a few hours sleep, and rethink your strategy. :-)
What you are doing now (I think) is loop through the results, and print them like this:
1 2
3 4
5 6
7 8
9 10
But what you want is
1 6
2 7
3 8
4 9
5 10
Problem, you can't print result 6 one the same line as 1, because after printing 1, your database will return result 2, not 6.
So what you do is loop through the results, and put them all in an array. Because you can access the elements of an array in any order you like.
so do something like this:
$aData = array();
WHILE ($db->next_record())
{
$sid = $db->f("subcat_id");
$subname = $db->f("subcat_name");
$no_tips = $db->f("no_tips");
$aData = array('sid'=>$sid, 'subname'=>$subname, 'no_tips'=>$no_tips);
}
after that, you will have all your database results in a nice array and you can access them like this:
echo $aData[5]['subname'];
echo $aData[7]['no_tips'];
etc.
Now you can start printing them.
First start a loop (rtfm on the syntax) to loop through half the elements.
Inside the loop you can access the data from the results and print it in a table row.
$iNumResults = count($aData);
$iNumRows = $iNumResults/2;
for ($iT=0; $iT<$iNumRows); $iT++)
{
echo '<TR>';
// first column
echo '<TD>'.$aData[$iT]['subname'].'</td>';
// second column
echo '<TD>'.$aData[$iT+$iNumRows]['subname'].'</td>';
echo '</tr>';
}
As for the alternating color, you can use a simple mathematical operation called 'mod' on the rowcounter:
if ($iT%2)
{
$sBackgroundColor='black';
}
else
{
$sBackgroundColor='while';
}