I have to build html table that will look like this:
But the fields and head names I get from database. First query - returns fields description, second query reurns fields values. I spent a lot hours trying to reach this. So what I do:
<table>
<tbody>
<?php
foreach ($comments as $comment) { // $comments is array of strings
?>
<td><b><?= $comment ?></b></td>
<?php}?>
</tbody>
<?php
foreach ($field_names as $fn) { // $field_names is array_keys($result)
?><tr><?php
foreach ($result as $r) { // $result - values of fields
?>
<td><?= $r[$fn] ?></td>
<?php
}?>
</tr>
<?php
}
?></table>
But in this way I'm getting my content transposed. Any help, thanks.