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.
&l
Something like this, maybe
function create_table($data) {
$res = '';
$max_data = sizeof($data);
$ctr = 1;
foreach ($data as $db_data) {
if ($ctr % 2 == 0) $res .= '' . $db_data['id']. ' ';
else {
if ($ctr < $max_data) $res .= '' . $db_data['id']. ' ';
else $res .= '' . $db_data['id']. ' ';
}
$ctr++;
}
return $res . '
';
}
Course, you can modify style of table to fit your needs.
Call it like this:
echo create_table($data);
(example for 7, 4, 3 and 8 id's)

It returns table with same number of rowsin each column if you pass even number of id's or table where last row is merged if you pass odd number of id's into function.