I am trying to do so whenever my while loop reach each 4 result (4,8,12,16 etc) it will create a new table row.
It should be like this:
[table row]
[data] [data] [data] [data]
[/table row]
[table row]
[data] [data] [data] [data]
[/table row]
and so on...
Currently I have this:
<?php
$cat=mysql_query("SELECT * FROM kb_categories");
$i = 0;
while($catData=mysql_fetch_assoc($cat)):
$i ++;
//Select the numbers of articles inside each category.
$number=mysql_num_rows(mysql_query("SELECT * FROM kb_articles WHERE cat_id='".$catData['id']."'"));
?>
<td><img src="/themes/dream/images/icons/folder.gif"><span><?php echo $catData['name']; ?></span> (<?php echo $number; ?>)</td>
<?php endwhile; ?>
Right now, it just generates this:
[table row]
[data] [data] [data] [data] [data] [data] etc.
[/table row]
I am just not sure how to use the $i in this example. Can someone help me?