I'm trying to use PHP and MySQL together to display images in a table. I've gotten it to work fine, and I've gotten it to display ONE row of images.
What I really want to do is to show a certain number of records using the Repeat Region function in Dreamweaver MX, but I can only get it to repeat horizontally.
I want to be able to display say, 25 images in a table, more than one row, more than one column.
My code now is:
[PHP<?php
$maxRows_pics = 6;
$pageNum_pics = 0;
if (isset($HTTP_GET_VARS['pageNum_pics'])) {
$pageNum_pics = $HTTP_GET_VARS['pageNum_pics'];
}
$startRow_pics = $pageNum_pics * $maxRows_pics;
mysql_select_db($database_pictures, $pictures);
$query_pics = "SELECT * FROM pictures";
$query_limit_pics = sprintf("%s LIMIT %d, %d", $query_pics, $startRow_pics, $maxRows_pics);
$pics = mysql_query($query_limit_pics, $pictures) or die(mysql_error());
$row_pics = mysql_fetch_assoc($pics);
if (isset($HTTP_GET_VARS['totalRows_pics'])) {
$totalRows_pics = $HTTP_GET_VARS['totalRows_pics'];
} else {
$all_pics = mysql_query($query_pics);
$totalRows_pics = mysql_num_rows($all_pics);
}
$totalPages_pics = ceil($totalRows_pics/$maxRows_pics)-1;
?>[/code]
And the code to display and repeat the images in one row:
<?php do { ?>
<td><img src="<?php echo $row_pics['path']; ?>" width="70" height="73"></td>
<?php } while ($row_pics = mysql_fetch_assoc($pics)); ?>