[Original] Sub-page beginner tutorial, suitable for beginners, how to solve

Source: Internet
Author: User
[Original] Sub-page beginner tutorial, Suitable for beginners
The corresponding girl moderator's call, first caught dead, right when a start. Novice can see, master do not look.


PHP Code
  
  
   
  <title>Pagination instance</title>
  $total _page $total _page: $page;//Avoid $_get["page"] greater than total pages//page link start $page_link= "", if ($total _page>1) {$page _link= "altogether {    $total _page} page ";    $page _link.= "The current {$page} page";    $page _link.= "Home";        if ($page >1) {//page number is greater than 1, display the previous page link $pre _page= $page-1;    $page _link.= "<<"; }//Flip list for ($i =1; $i <= $total _page; $i + +) {if ($i = = $page) {//Highlight current page number $pag        E_link.= "$i";        } else {$page _link.= "$i";    }}//page is less than the total number of pages to display the next page link $next _page= $page +1;    if ($next _page< $total _page) {$page _link.= ">>"; } $page _link.= "last page";} Output record $offset= ($page-1) * $page _size; $query =mysql_query ("SELECT * from Product limit $offset, $page _size") or Die (Mysql_ Error ()); echo "
  
  
      "while ($rs =mysql_fetch_array ($query)) {echo"
    • {$rs ["id"]}-{$rs ["Ename"]}
    • ";} echo "
        $page _link";? >


After reading, consider the following questions:

1. If there are a lot of page numbers, there may be hundreds, this page link list how to output?



Not to be continued ....

------Solution--------------------
Thank you for sharing the small white I paged is home previous next last total x page wood has the middle of the page number list study Thank you Jordan Brother to share!
------Solution--------------------
Study, sincerely thank you, I am a novice ...
------Solution--------------------
I have written a generic paging code for Java. Looks like this.

<< < [1] [2] [3] 4 [5] [6] [7] [8] [9] [ten] > >>
Click >> Post
<< < [[] [] [] [] [] [] [] [] [] [] [] > >>
Then click >> After
<< < 21 [22] [23]
  • 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.