Hi,
Here is some pseudo code that might be helpful.
PHP Code:
<?php
// fetch the images from the database
$query = 'SELECT name, title FROM images';
$result = mysql_query($query) or die(mysql_error());
// display the images
$counter = 0;
while(( $image = mysql_fetch_assoc($result) ) && ( $counter++ >= 0 ))
{
// the start of a new row?
if( $counter % 4 == 0 )
echo '<tr>';
// display the current image
echo '<td><img src="', $image['name'], '" alt="" title="', $image['title'], '" /></td>';
// end of the row?
if( $counter % 4 == 3 )
echo '</tr>';
}
// fill the empty cells
if( $counter % 4 != 3 )
{
do { echo '<td></td>'; }
while( $counter++ % 4 != 3 );
echo '</tr>';
}
?>
Yours, Erik.
Bookmarks