How do I display all my database information in an html table?

This example displays all of the thumbnail pictures in an html table. By changing one variable, you can have as many cells per row as you want.
NOTE: If you have a large number of images, you may want to modify this by adding PAGINATION to keep your screen more manageable

Now the actual scripting.

5/* set max columns for table */
$i 0/* initially set counter to use in starting and ending rows */
<table border ="2">
<?PHPinclude('db.php'); /* make connection to database here */
$query "Select * FROM album"/* define query */
$result mysql_query($query);   /* execute query */
$total_cells mysql_num_rows($result);  /* count total cells to be displayed */
$total_rows ceil($total_cells $max_columns);  /* calculate total rows needed */
$junk1 $total_rows $max_columns;  /* calculate number of empty cells in last row */
$junk2 $junk1 $total_cells;
$junk2==0) { 
$last_row "</tr>"
$j 0
$last_row $last_row "<td></td>"
$j ++; 
$last_row $last_row "</tr>"
$row mysql_fetch_array($result)) {  /* begin looping thru the results */
$image "thumbs/" .  $row['image']; 
$i == 0){ 
$i ++; 
    <td align="center" valign="center"><IMG src = "<?PHP echo $image?>"></td>
$i $max_columns) {   /* check if need to close row */
echo "</tr>"
$last_row "</table>"/* clean up last row */

An example where we set the number of columns to 5.

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/liteb/public_html/toh/db.php on line 6

Warning: mysql_connect(): Access denied for user 'liteb_nick01'@'localhost' (using password: YES) in /home/liteb/public_html/toh/db.php on line 6
could not connect