PHP Limit Paging (paging) code

Source: Internet
Author: User
PHP Limit Paging code, there is a need for friends under reference.

The Database Operations section is omitted, and only the paging code is written.

$display =10;//number of records per page if (isset ($_get["P"]) {$num _pages=$_get["p"];//current page}else{$sql = "SELECT count (*) from F_user"; $rs = @mysql_query ($sql) or Die (Mysql_error ()); $row =mysql_fetch_array ($RS); $num _records= $row [0];//record Total if ($num _records> $display) {$num _pages=ceil ($num _records/$display);} else{$num _pages=1;}} if (Isset ($_get["s"])) {$start =$_get["s"];} else{$start = 0;} $sql = "SELECT * from F_user the ORDER by ID ASC limit $start, $display"; $rs = @mysql_query ($sql) or Die (Mysql_error ()); Echo '
     
      '; Echo '
      
         '; Echo ' 
         '; Echo ' 
        '; Echo ' 
       
         '; Echo ' 
         '; Echo ' 
         '; Echo ' 
         '; Echo ' 
         '; Echo ' 
        '; while ($rows =mysql_fetch_array ($rs)) {echo ' 
       
         '; Echo ' 
         '; Echo ' 
        '; Echo ' 
         '; Echo ' 
         '; Echo ' 
         '; Echo ' 
        '; } mysql_free_result ($rs);  Mysql_close ();  Echo ' 
       
         '; Echo ' 
         '; Echo ' 
        '; Echo ' 
      
user management
account user group registration time management
'. $rows ["id"]. ' '. $rows ["U_name" ].' '. $rows ["U_uls"]. ' '. $rows ["U_joindate"]. ' edit delete
"if ($num _pages>1) {$current _page= ($start/$display) +1; if ($current _page!=1) {echo ' previous page '; } for ($i =1; $i <= $num _pages; $i + +) {if ($i! = $current _page) {echo '. $i. '; }else{echo $i. "; }}}else{$current _page=1;} if ($current _page! = $num _pages) {echo ' next page ';} Echo '
';
  • 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.