how to creat a pagination in PHP?

annyphp's Avatar, Join Date: Dec 2010
Newbie Member
As a php developer, you will often be tasked to display large amounts of data to the user in some kind of easy to read format.
I have some records, I want to display records page by page!
Any one give tutorial about pagination in php?
I found some php pagination scripts listed on the site
underground_devil's Avatar, Join Date: Jan 2011
Go4Expert Member
i send you my simple code for pagination

PHP Code:
="SELECT * FROM table_name";

$q="SELECT * FROM table_name LIMIT $lim,5";
$p=mysql_query($q) or die('query error');
$r['user']."<br>";   // fetching data

" [ <a href=index.php?p=5&start=$i>".$j."</a>] | "// change according to you page


may be there would some easy method but i like to use this simple code
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Instead of fetching the complete data at the top you could use count(*) as well to make it more efficient.