How to create paging in PHP (page no)

how to create paging when fetch data from mysql database



$sql = "select * from product";
$rs  = mysql_query($sql) or die("database error");

$i=1;
while($re  = mysql_fetch_array($rs))
{
S.No : echo $i."<br>";
Product Name : echo $re['item'];
Product Description : echo $re['desc'];
$i++;
}


I want display only 10 product on one page if product more than 10 then print on second page.

plz help me…

This is a fairly frequently aired subject on this forum, so my best advice is to search this forum for the terms paging and/or pagination.

Or even google [google]pagination tutorial php[/google].

yaa I tried but not found any correct script which are working so I just ask in this forum

Well, seeing as you have read those tutorials and discounted them, you must at least now know how to use mysql LIMIT clause to fetch blocks of say, 10 rows from your database.

So where are you up to? What problem have you hit?

They’re not working? Maybe you didn’t implement them correctly?

Try to implement one of the solutions already posted in these forums (there’s about 3000), and if you have trouble, show us your code.