Hello take a look at this example code. I think it is basically what you want. I've created an array to simulate database results. Instead of the for ($i=0;$i<count($array);$i++) you would have
while($row=mysql_fetch_array($result) { and instead of $array[$i] you would have $row[0]
<table border=1>
<tr>
<?
$r=0;//Row counter
$c=0;//Column counter
$array=array('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30');
for ($i=0;$i<count($array);$i++) {
echo "<td>".$array[$i]."</td>\n";
$c++;//Increment column position
if ($c==3) { // End of column, start new row
echo "</tr><tr>\n";
$c=0;//Reset row counter
$r++;//Increment C: end of row
}
if ($r==5) { // if row position is at 5 add a spacer row
echo "<td colspan=3> </td></tr><tr>";
$r=0;
}
}
?>
</tr>
</table>
I hope this helps!
Miles