Showing posts with label next and previous links. Show all posts
Showing posts with label next and previous links. Show all posts

Sunday, September 8, 2013

Simple Pagination Script in PHP

Let's do a bit of coding in PHP with mysql as the DBMS. Here, I will present the simplest of code to make a page which shows a fixed number of records on a page with the next and previous links to access the next or previous records.I think you are confused what I am saying.

Let's take an example.
Suppose there is a database named "profile"(Let's say in MYSQL). It has a table named "tbl_comment" which has two fields cid and ctext. Now there is a php file named comment.php which will show the list of comments from the tbl_comment table. As the number of comments in the table increase, we need a system to show them systematically on the screen so that the end-user has not to scroll much to read the comments. There comes the pagination script handy.