PHP Paging code error, (only the last 27 points left)

Source: Internet
Author: User
PHP Paging code error, consult a master. (Only the last 27 points left)
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.
 
  $pages =ceil ($count/$list _num);
echo "

















"; if ($offset) {$preoffset = $offset-$list _num;print " ";} else {echo ' ";} $newoffset = $offset + $list _num; if ($pages!=0) && (($newoffset/$list _num)! = $pages)) {print (" ");} else{echo " ";} $pageno = ($offset/$list _num) +1;echo "
Total ". $pages." PagePrevious pagePrevious pageNext pageNext pageThePage
";
?>
PHP page PHP page

Share to:


------Solution--------------------
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
!--? php
if ($_get[offset]) {
$offset = $_get[offset];
}
$count = 100;
$list _num = 5;
$pages =ceil ($count/$list _num);
Echo
















  • "; if ($offset) {$preoffset = $offset-1; Print " "; } $newoffset = $offset +1;//$list _num; if ($pages!=0) && (($newoffset/$list _num)! = $pages)) {print ("
    There are currently ". $count." Record total. "$pages." Page ";} else {echo " previous page ");

    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.