Based on PHP to achieve the data paging display function, PHP implementation of pagination display _php tutorial

Source: Internet
Author: User
Tags rowcount

PHP implementation of data paging display function, PHP implementation of pagination display


The example of this article for everyone to share the data page display function PHP implementation code for your reference, the specific content as follows

Implementation code:

  
 
  
   <title>User List</title><?php $con = mysql_connect ("localhost", "root", "");  mysql_query ("Set names UTF8");    mysql_select_db ("Zhiye", $con);   $pageSize = 1;   The number of displays per page $rowCount = 0;    To get $pageNow = 1 from the database;  Number of pages currently displayed//if there is pagenow to use, there is no default on the first page.  if (!empty ($_get[' Pagenow ')) {$pageNow = $_get[' Pagenow '];  } $pageCount = 0;  Represents the total number of pages $sql 1 = "SELECT count (ID) from user";    $res 1 = mysql_query ($sql 1);  if ($row 1=mysql_fetch_row ($res 1)) {$rowCount = $row 1[0];    }//Calculate total number of pages, ceil 1 $pageCount = ceil (($rowCount/$pageSize));  When using SQL statements, be aware that some variables should be assigned values.    $pre = ($pageNow-1) * $pageSize;  $sql 2 = "SELECT * from User limit $pre, $pageSize";   $res 2 = mysql_query ($sql 2); while ($row =mysql_fetch_assoc ($res 2)) {echo $row [' user_name ']. "
"; echo $row [' name ']. "
"; echo $row [' email '].
"; echo $row [' Password ']. "
"; Echo $row [' Tel '].
"; } for ($i =1; $i <= $pageCount; $i + +) {echo "$i"; }?>

The above is the whole content of this article, I hope to give you a reference, but also hope that we support a lot of help the home.

http://www.bkjia.com/PHPjc/1133085.html www.bkjia.com true http://www.bkjia.com/PHPjc/1133085.html techarticle based on the PHP implementation of data paging display, PHP implementation of the page shows the example of this article to share the data page display function PHP implementation code for your reference, the concrete content as follows ...

  • Related Article

    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.