I have a database set up with tables of images. I have pages set up to 
display the images 12 per page in a table of 2 rows/6 cols. There is a next 
link that loads the next 12 images from the database. All works just fine 
except for one little problem - the first time the page is loaded the first 
image is not number 1, but rather number 13. It is skipping the first 12 
images. 
1) What do I need to do to fix this? Must be something in the code below?
2) When I get to the last page of images, the next button is still active and 
will, when clicked on, load an empty page, because there are no more images 
to display. How do I prevent this (make the last page definately the last 
page)? (new images are often being added, so hard coding a last image number 
won't work)

<?
$new_pic=$pic+12;
    $conn=mysql_connect("localhost", "chip","carvin") or die ("Could not get 
the databse");
mysql_select_db("images", $conn) or die ("Could not select the database");
$sql="select * from ab limit $new_pic,12";
$result=mysql_query($sql);
while ($row=mysql_fetch_array($result))
   {
   printf("<td align=\"center\"><a href=\"%s\"><img 
src=\"../thumbs/%s\"></a></td>\n", $row["name"], $row["name"]);
   $i++;
   if($i %6==0)
           {
           echo "</tr>\n";
           }
   }
echo "<tr>\n<td colspan=\"6\" align=\"center\">\n<a 
href=\"../index.html\">Home</a>&nbsp;\n<a 
href=\"index.php?pic=$new_pic\">Next</a>\n</td>\n</tr>\n";
?>
-- 
Chip W
www.wiegand.org
<+><+><+><+><+><+><+><+>
Windows 95/NT - 32 bit extensions and a graphical shell for a 16 bit patch
to an 8 bit operating system originally coded for a 4 bit microprocessor,
written by a 2 bit company that can't stand 1 bit of competition.
<+><+><+><+><+><+><+><+>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to