About paging out a little bit of trouble finding out where to find the Great God Guide

Source: Internet
Author: User
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?

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.