Hi,
I'm modifying an Image Gallery script to call images from an SQL db, but am having problems with a WHILE loop in the middle - it seems to be missing a portion of the code and I can't find why... the page is at http://cheeks2k.port5.com/gallery/new_gallery2.php
and the code i'm using is below; any help would be GRATEFULLY received!
<table cellpadding="0" align="center" cellspacing="10" width="200" border="0">
<?php
// initialise variables
$dir = "/images/";
$thumbnail_dir = "thumbs/";
$num_rows = 4;
$photos_per_row = 5;
// connection script
(WITHHELD CONNECTION DETAILS HERE)
$sql = "select name,width,height from gallery";
$rs = mysql_query($sql,$conn);
$photos_per_page = $num_rows * $photos_per_row;
// check to see if the start variable exists in the URL.
// if not, then the user is on the first page - set start to 0
if(!isSet($start)) { $start = 0; }
// init i to where it needs to start in the photos array
$i = $start;
for ($row = 0; $row < $num_rows; $row++)
{
echo ("<tr>\n");
for ($col = 0; $col < $photos_per_row; $col++)
{
while ($photos = mysql_fetch_array($rs) )
{
$total_photos = sizeof($photos);
if ($i < $total_photos)
{
$thumbnail = $dir.$thumbnail_dir.$photos["name"];
echo ("<td style=\"border: 3px solid #fff\" align=\"center\"><a href=\"javascript:photo_open('photo_display.php?photo=".$dir.$photos["name"]."','".$photos["width"]."','".$photos["height"]."');\"><img src=\"".$thumbnail."\" width=\"100\" height=\"100\" border=\"0\"></a></td>\n");
}
else
{
echo ("<td> </td>\n");
}
$i++;
}
echo ("</tr>\n");
}
}
//end table
?>
</table>