I have a table with dynamic data in it. Each column of the table may hold 6 values. I want the table to display correctly, and to do so I need to add linebreaks to the last column of the table if it does have a multiple of 6 values in it.
For example, if there are 5 values pulled from the dbase, then there needs to be 1 linebreak in the first column. If there are 7 values pulled from the dbase, then there needs to be 5 linebreaks in the second column of the table.
For the life of me, I cannot think of a good way to come up with an equation that leaves me with the remainder I need. Does anyone have any ideas?
If you want to see my existing code it is below:
<?php
#Loop through fabric categories
$endrow=0;
foreach ($fab_array as $rownum=>$value)
{
$endrow = 1+$endrow;
echo "<a href=\"category/".$fab_array[$rownum]['invtype'].".html\">".$fab_array[$rownum]['invtype']."</a><br>";
if ($endrow ==6 or $endrow==12)
{
echo "</td><td width=\"148\"><br>";
}
}
?>