I have table with product_category
and its has more than 20 categories and I want to display them in table format like below image
I like to place categories in 5 td
then how I can be fixed towards tr
in a table
Below is code I have tried, but its not giving the desired output
And below is the image that might be solution I needed
Below code
<table>
<?php
$fquery5 = mysql_query("select Cat_ID, Cat_Name from product_category where Active_Flag=1");
$count1 = mysql_num_rows($fquery5);
$hor_length = 5;
$ver_length = $count1 / $hor_length;
$data1 = mysql_fetch_row($fquery5);
for ($i = 0; $i <= $ver_length; $i++) {
echo "<tr>";
for ($j = $i + $hor_length; $j <= $count1; $j++) {
echo "<td>";
echo "Id : " . $data1[0] . " = " . $data1[1];
echo "</td>";
}
echo "</tr>";
}
?>
</table>
Added resultant output image answered by @DaveRandom