Date: 08/30/01
- Next message: Robert Vukovic: "[PHP-DB] SQL problem"
- Previous message: Beau Lebens: "RE: [PHP-DB] PHP+Postgresql/Win32"
- In reply to: Jeff Oien: "[PHP-DB] Previous | Next (Again)"
- Next in thread: Jeff Oien: "RE: [PHP-DB] Previous | Next (Again)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi!
Don't use the ID to count prev or next image. Use the $offset variable
instead.
$result=mysql_query("select id,name,phone ".
"from TABLE where YOUR CONDITIONAL HERE ".
"order by ID asc limit $offset,$limit");
Regards
--Shin
"Jeff Oien" <jeff <email protected>> wrote in message news:PGEBKOPJJHHICHGDKCCIAEHADCAA.jeff <email protected> > I'm having a hard time figuring this out. I have a photo album that displays > one image at a time. I want to have Previous and Next links for images in > a users album. This was suggested: > http://www.phpbuilder.com/columns/rod20000221.php3 > but it seems to be more for a number of results instead of one. > > At first I used the id field which is auto_increment and did -1 for > previous +1 for next but then realized if they delete an image in > the album the id field is no longer successive by 1. I can count > the number of images in an album but not sure how to know which > is the first, which is the second etc. and know which the current > one is if the id field has gaps in it. Not sure if that made any sense. > Jeff Oien
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Robert Vukovic: "[PHP-DB] SQL problem"
- Previous message: Beau Lebens: "RE: [PHP-DB] PHP+Postgresql/Win32"
- In reply to: Jeff Oien: "[PHP-DB] Previous | Next (Again)"
- Next in thread: Jeff Oien: "RE: [PHP-DB] Previous | Next (Again)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

