Phplimit paging code

Source: Internet
Author: User
Phplimit paging code
Php limit paging code. For more information, see.

The database operation section is omitted, and only paging code is written.

$ Display = 10; // number of records per page if (isset ($ _ GET ["p"]) {$ num_pages = $ _ GET ["p"]; // Current page number} else {$ SQL = "select count (*) from f_user"; $ rs = @ mysql_query ($ SQL) or die (mysql_error ()); $ row = mysql_fetch_array ($ rs); $ num_records = $ row [0]; // total number of records 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 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'
        '; 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
IDAccountUser GroupRegistration timeManagement
'. $ Rows ["id"].''. $ Rows ["u_name"].''. $ Rows ["u_uls"].''. $ Rows ["u_joindate"].'Edit and 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.