At a glance a couple of problems. in your last
if($row_count % 18 == 0)
{
$row_count = 0;
print "<tr>";
}
the <tr> should be </tr>
Also you want to generate the beginning <tr> at the beginning of the row and the </tr> at the end. Since the same IF condition generates both the <tr> and the </tr> you will get them only generated in the same itteration. You probably want something like
if($row_count==17) //for a 18 col setup
{
$row_count = 0;
print "</tr>";
}
Anyway, here is a bare bones setup of what you want to do. Just check out the structure and plug your own data in.
<table width="100%" border="1" cellspacing="4" cellpadding="4" align="center">
<?
$cColumns=8;
$cDatamax=53;
$usRow_count=0;
$usData_count=0;
while($usData_count<$cDatamax)
{
$usData_count++;
if (($usRow_count % ($cColumns)) == 0)
{
print("\n<tr>");
}
?>
<td>
<?echo $usData_count?>
</td>
<?
if (($usRow_count==($cColumns-1)))
{
print("</tr>");
}
$usRow_count++;
}
?>
</table>
Hope if makes sense as I'm a little new to all this stuff.