I have a for each loop that displays books with information, one on top the other, I would prefer to present these books in a grid (5rows x 5columns). I just can't figure out how to do this.
Can anyone please help me with this?
here is the code:
function display_books($book_array)
{
//display all books in the array passed in
if (!is_array($book_array))
{
echo '<br />No books currently available in this category<br />';
}
else
{
//create table
echo '<table width = \"100%\" border = 0>';
//create a table row for each book
foreach ($book_array as $row)
{
$url = 'show_book.php?isbn='.($row['isbn']);
echo '<tr><td>';
if (@file_exists('images/'.$row['isbn'].'.jpg'))
{
$title = '<img src=\'images/'.($row['isbn']).'.jpg\' border=0>';
do_html_url($url, $title);
}
else
{
echo ' ';
}
echo '</td><td>';
$title = $row['title'].' by '.$row['author'];
do_html_url($url, $title);
echo '</td></tr>';
}
echo '</table>';
}
echo '<hr />';
}