I want to create dynamic rows and column with the help of PHP and HTML but I am little confused about this code so some help is definitely appreciated.
<table>
<?php
$tr = 0;
foreach ($data as $db_data) {
$tr++;
if ($tr == 1) {
echo "<tr>";
}
echo "<td>";
echo $db_data['id'];
echo "</td>";
}
if($tr == 2){
}
?>
</table>
Scenario is so simple:
Mysql data return 6 no of records from for-each loop the result will be show like this image
Same way the Mysql data return 3 no of records the result will be show like this image