All Products
Connecting to a database
Require_once ' conn.php ';
$sql = "SELECT * from Tb_user";
$result =mysql_query ($sql);
$num =mysql_num_rows ($result);
$pagesize =3;//Set the number of records per page
$pages =ceil ($num/$pagesize);//Get Total pages
if ($pages <1) {$pages = 1;} Set the total number of pages at least 1 pages
$page =$_get[page];//Get the number of pages passed over
if ($page > $pages) {$page = $pages;} If the number of pages passed is larger than the total number of pages, let it be equal to the total number of pages
if ($page <1) {$page = 1;} If the number of pages passed is less than 1, let him be equal to 1.
$kaishi = ($page-1) * $pagesize;//prepare for the next step, the initial record of limit
$sql = "SELECT * from Tb_user the ORDER by id desc limit $kaishi, $pagesize";//Obtain records starting from the calculated initial values, altogether $pagesize strips
$result =mysql_query ($sql);//Get Results
while ($row =mysql_fetch_array ($result))
{
Echo ' name: '. $row [' USERNC '];
Echo '
';
}
?>
Here are the pagination
Home "> previous page Current section Page > next page > End
The above is the code content display no problem mainly first prev page next page The last one of these points doesn't respond.
Reply to discussion (solution)
What is the 127.0.0.2/ceshi1.php?page= of your URL ?
Isn't the page supposed to be a number?