Limit the number of results, and make into new pages

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
tom8521
Forum Commoner
Posts: 25
Joined: Thu May 13, 2010 6:24 am

Limit the number of results, and make into new pages

Post by tom8521 »

Sometimes the number of results you can retrieve from a database are huge, which is why it is important to place the first 10 results and links to further results.

My website deals with retrieving properties for sale, so I need to only retrieve the first 10 properties, then link to the next page of 10 and so on.

How do I do this?
buckit
Forum Contributor
Posts: 169
Joined: Fri Jan 01, 2010 10:21 am

Re: Limit the number of results, and make into new pages

Post by buckit »

what you are looking for is Pagination.


I have written one myself but it took me a while to work it out and I still have a flaw with it (when I hit a certain number of pages, the last page has no results.. so its a calculation problem)

anyway... here is a good tutorial to get you started... it will help you a lot to understand how it works rather than just throwing code at you.

http://www.phpfreaks.com/tutorial/basic-pagination

-Jeff
Post Reply