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");