Explore BrainMass

Using limit and limitstart to create pages of data

The purpose of the attach php code searches a MYSQL database and then return the results to the screen.

It works very well, just that it displays all the search results all in one screenful. If it found 100 records then that's how many records it displays to the screen at a time.

Need help making it display 10 records at a time, if search results returns more than 10 records, then it should display a previous and next links as well as page numbers linking to each page. In brief I need help adding pagination to the existing PHP codes. Please let me know how many more credits are require.


Solution Preview

It is quite common for scripts that display data from a database to present the information in pages. When the data to display conists of thousands of records it is essential to do this. Fortunately MySql provides an extension to SQL that makes this task relatively simple.

In order to read data from a database the SQL "SELECT" statement is used. The MySql implementation of SELECT allows a limit clause. The limit clause allows the query to specify the number of records that should be returned and the starting point for ...

Solution Summary

This solution shows how to use the MySql limit and limitstart clauses of the SELECT statement to create pages of data when displaying data from a php script.