Page 1 of 1

help with limiting results shown

Posted: Wed May 25, 2005 10:53 am
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

Posted: Wed May 25, 2005 11:12 am
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.