Pagination with database records

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Sarvesh Kumar
Forum Newbie
Posts: 1
Joined: Wed Dec 17, 2003 2:03 am
Location: Lucknow
Contact:

Post by Sarvesh Kumar »

i had select images by category through mysql database.if a category has 10 images and i want to display only 5 on a page, and other 5 are in other but the other 5 will display when i click next on the first page.How i can do it by a php script?
User avatar
aquila125
Forum Commoner
Posts: 96
Joined: Tue Dec 09, 2003 10:39 am
Location: Belgium

Post by aquila125 »

SELECT * FROM images WHERE ... ORDER BY ... LIMIT ".($page*5).",5

this should do the trick... $page must be between 0 and (number_of_images_in_db * 5)
Post Reply