Hello Zabadin, and welcome to PHPBuilder.
In essence, this is pretty easy. You might not even need to use any array building for this task. By way of example see the following; it might not be appropriate for your application, but it's a common task that often looks likes this:
<?php
// connect to your database.
connect_to_my_db(); // my 'fake' db connect function
//do a little HTML
?>
<table>
<?php
// query the database
$sql="select author, price, code, rack from book;";
$result=mysql_query($sql);
if ($result) {
while ($row=mysqli_fetch_assoc($result)) {
echo "<tr><td>".$row['author']."</td><td>".$row['price']."</td><td>"
.$row['code']."</td><td>".$row['rack']."</td></tr>\n";
}
} else {
//we didn't get a result --- show some error message
show_error($foo); // our error code goes here
}
//close off the table
?></table>