Paging through records

wxdqz

New Member
Ok... I'm fairly new to PHP (coming from ASP...blick) and I'm attempting to convert my website from ASP into PHP. I've seen a couple posts already on how to do this but none which cover my scenario:

I have a database which contains 'items'. Items are in differen't 'categories' meaning some are squares, blocks, circles, etc.

I need to create code/a query to allow 21 items per page based on their category (yes, this is an online store). So if a user selects circles, it will display the first 21 items, with a NEXT/PREV link showing the rest of the items.

I cannot go by the auto_increment'ing id because the first item in the circle category might be id 1 and the second item might be id 15, so this wouldn't work.
(select * from items where category = 2)

I see how I can (utilizing a for loop) display the first 21 records, the difficulty comes when I need to display the second set of 21 records or third, etc...

Any help would be greatly appreciated! I realize this is probably very simple, but for someone who is used to using ASP's CURSOR's and 'PageSize' commands PHP is quite limited on documentation for this type of thing.

Thanks!
Jon
 
Back
Top