I am trying to display a list of categories from a Database result, As the list will increase day by day how can i split the li elements so that they align themselves horizontally and vertically.
Here is my code snippet
<?php
$query="SELECT id,category FROM category`";
$res=mysql_query($query);
$count=mysql_num_rows($res);
while($data=mysql_fetch_array($res))
{
?>
<table>
<tr>
<td>
<li><a><?= $data['category']?></a></li>
</td>
</tr>
</table>
<?php
}
?>
I tried using css, it worked for smaller results, but it became difficult to organize the list equally. Example: Flipkart lists their categories in the following way
Any suggestions, Or any other simple way to handle large list of categories?
Thank you.