PHP MySQL Pagination - MySQL Constraints -

PHP MySQL Pagination

Best PHP Training with Live Project in Noida Fee is only 7500/-Click here for FREE DEMO.


How to use Pagination in PHP MySQL

MySQL SELECT query may display the thousands of records from the database.
TO show these thousands of records in a single page is not possible. for that purpose we use the concept of MySQL pagination. In Mysql pagination we divide results into many pages.Basically it is the method of showing somewhat lesser results on page instead of putting them all together on a single page.
Suppose there are 15 records in a table. 5 records on each page are displayed by using pagination.
each of the 3 pages will have 5 records.Each time we click on next page the next 5 records will got
displayed and the previous 5 records will get removed.

Below is the Example.
In above example there is paginate function which has two arguments , one is the connection of database
and other is Limit variable which is basically the number of records on each page.
FOUND_ROWS() function return the number of rows from the table in the absence of limit clause.

Show 5 records on each page

There are 15 records inside userinfo table. Show only 5 records on each page.(use Pagination)

save as paginate.php

Select records from userinfo table(Total records are 12). show 5 records on each page.

In display.php we have included the paginate.php and the results fetched by it are shown in a tabular form. The records in the result variable are fetched by mysql_fetch_array() function which is put in a while loop to display all records.
The information fetched by the display function is subdivided into pages and each page contain maximum of 5 records.

Keep Updating yourself