PHP Paging code error, consult a master. (Only the last 27 points left)

Source: Internet
Author: User
The result is the first page that displays only the contents of the database, and clicking the next page still stays on the first page.
 
                        There are currently ". $count." Record                total ". $pages." Page ";  if ($offset) {$preoffset = $offset-$list _num;print "Previous";}  else {echo  "prev";} $newoffset = $offset + $list _num;  if ($pages!=0) && (($newoffset/$list _num)! = $pages)) {print ("next page");}  else{echo "Next page",} $pageno = ($offset/$list _num) +1;echo "sectionPage             ";   ? >


Reply to discussion (solution)

You use the chrome review element to see "next page" This place has no connection,
Then there is the one you used to tell you the landlord that day
Abstract ($_request); This is going to be added to the top

 
                        There are currently ". $count." Record                total ". $pages." Page ";    if ($offset) {     $preoffset = $offset-$list _num;  Print "Previous page";}    else {  echo  "prev";  }   $newoffset = $offset +1;//$list _num;    if ($pages!=0) && (($newoffset/$list _num)! = $pages))  {   print ("next page");  }    else{echo "next page";}   $pageno = $offset;  echo "sectionPage             ";   ? >
 
  

I don't know if I misunderstood LZ's meaning.

 
                        There are currently ". $count." Record                total ". $pages." Page ";    if ($offset) {     $preoffset = $offset-$list _num;  Print "Previous page";}    else {  echo  "prev";  }   $newoffset = $offset +1;//$list _num;    if ($pages!=0) && (($newoffset/$list _num)! = $pages))  {   print ("next page");  }    else{echo "next page";}   $pageno = $offset;  echo "sectionPage             ";   ? >
 
  

Do not know is not misunderstood the LZ's meaning I used your code, although the bottom page after the bottom of the display is the second, but the contents of the form is the first page ah?

 
                        There are currently ". $count." Record                total ". $pages." Page ";    if ($offset) {     $preoffset = $offset-$list _num;  Print "Previous page";}    else {  echo  "prev";  }   $newoffset = $offset +1;//$list _num;    if ($pages!=0) && (($newoffset/$list _num)! = $pages))  {   print ("next page");  }    else{echo "next page";}   $pageno = $offset;  echo "sectionPage             ";   ? >
 
  

Do not know is not misunderstood the LZ means that the page is changing, the content is unchanged.

As for the SQL statement of the database, I'm not quite sure how it was written.
Typically select * from ' table ' ORDER BY id DESC LIMIT 1 $offset * $count/$list _num, ($offset + 1) * $count/$list _num
The following code has been tested with my own database and can be run

 
                        There are currently ". $count." Record                total ". $pages." Page ";    if ($offset) {     $preoffset = $offset-1;  Print "Previous page";}    else {  echo  "prev";  }   $newoffset = $offset +1;//$list _num;    if ($pages!=0) && (($newoffset/$list _num)! = $pages))  {   print ("next page");  }    else{echo "next page";}   $pageno = $offset;  echo "sectionPage             ";   ? >
 
  

As for the SQL statement of the database I'm not quite sure how it was written.
is generally select * from ' table ' ORDER BY id DESC LIMIT 1 $offset * $count/$list _num, ($offset + 1) * $count/$list _num
The following generation The code has been tested with my own database and can run

 
                        There are currently ". $count." Record                total ". $pages." Page ";    if ($offset) {     $preoffset = $offset-1;  Print "Previous page";}    else {  echo  "prev";  }   $newoffset = $offset +1;//$list _num;    if ($pages!=0) && (($newoffset/$list _num)! = $pages))  {   print ("next page");  }    else{echo "next page";}   $pageno = $offset;  echo "sectionPage             ";   ? >
 
  
Thanks a lot!
  • 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.