help with limiting results shown

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
godonholiday
Forum Newbie
Posts: 7
Joined: Mon Feb 07, 2005 3:12 pm
Location: liverpool

help with limiting results shown

Post by godonholiday »

i have an array that displays a number of images that the user has searched for, i want to only display the first 3 images and then have the others on the next page and so on, can anyone help?

thanks g
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

what you're looking for is pagination. You can search these forums for that word and find plenty of help. Basically, what you need to do is have some way to remember where you are in the result set as you move from page to page. If you are pulling results from a mysql db, you can use LIMIT to only pull the results you want. If all you have is an array, but you know enough about the indeces of it, you can manually pull a different chunck of it on each page.
Post Reply