Php paging code error (only 27 points left)

Source: Internet
Author: User
An error occurred while turning php code. (Only the last 27 points left) the running result shows only the first page of the database content, and the "next page" is still displayed on the first page. & Lt ;? Php $ pages = ceil ($ count/$ list_num); & nbsp; & php paging code error. please consult with us. (Only 27 points left)
The running result only displays the first page of the database content. clicking "next page" still stays on the first page.
 $ Pages = ceil ($ count/$ list_num );
Echo"
 
  There are currently a total of ". $ count." records
Total ". $ pages." pages";
If ($ offset ){
$ Preoffset = $ offset-$ list_num;
Print" Previous Page";}
Else {
Echo" Previous Page";
}
$ Newoffset = $ offset + $ list_num;
If ($ pages! = 0) & ($ newoffset/$ list_num )! = $ Pages ))
{
Print (" Next page");
}
Else {echo" Next page";}
$ Pageno = ($ offset/$ list_num) + 1;
Echo" The Page
  ";
?>
Php? Share the following link with PHP:
------ Solution --------------------
I don't know how to write the SQL statements of the database.
Select * from 'table' order by id desc limit 1 $ offset * $ count/$ list_num, ($ offset + 1) * $ count/$ list_num
The following code has been tested in my own database and can be run
 If ($ _ GET [offset]) {
$ Offset = $ _ GET [offset];
}
$ Count = 100;
$ List_num = 5;
$ Pages = ceil ($ count/$ list_num );
Echo"
 
  There are currently a total of ". $ count." records
Total ". $ pages." pages";


If ($ offset ){
$ Preoffset = $ offset-1;
Print" Previous Page";}
Else {
Echo" Previous Page";
}
$ Newoffset = $ offset + 1; // $ list_num;


If ($ pages! = 0) & ($ newoffset/$ list_num )! = $ Pages ))
{
Print (" Next 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.