Php implements the php pagination for scoring on webpages. if (isset ($ _ GET [page]) {& nbsp; $ pageintval ($ _ GET [page]);} else {& nbsp; $ page1 ;}& nbsp; page size $ PageSize10; & nbsp; get the total data volume $ s php to display the scores of Web pages
Php paging
If (isset ($ _ GET ['Page']) {
$ Page = intval ($ _ GET ['Page']);
}
Else {
$ Page = 1;
}
// Number of pages per page
$ PageSize = 10;
// Obtain the total data volume
$ SQL = "select count (*) as amount from news ";
$ Result = mysql_query ($ SQL );
$ Row = mysql_fetch_row ($ result );
$ Amount = $ row ['amount'];
// Count the total number of pages
If ($ amount ){
If ($ amount <$ page_size) {$ page_count = 1;} // if the total data volume is less than $ PageSize, there is only one page
If ($ amount % $ page_size) {// Retrieve the total data volume divided by the remainder of each page
$ Page_count = (int) ($ amount/$ page_size) + 1; // if there is a remainder, the number of pages equals the total data volume divided by the result of each page number and then adds one
} Else {
$ Page_count = $ amount/$ page_size; // if there is no remainder, the number of pages equals the total data volume divided by the result of each page
}
}
Else {
$ Page_count = 0;
}
// Flip link
$ Page_string = '';
If ($ page = 1 ){
$ Page_string. = 'Page 1 | previous page | ';
}
Else {
$ Page_string. = 'Page 1 | previous page | ';
}
If ($ page = $ page_count) | ($ page_count = 0 )){
$ Page_string. = 'next page | last page ';
}
Else {
$ Page_string. = 'next page | last page ';
}
// Obtain data and return results in two-dimensional array format
If ($ amount ){
$ SQL = "select * from table order by id desc limit". ($ page-1) * $ page_size. ", $ page_size ";
$ Result = mysql_query ($ SQL );
While ($ row = mysql_fetch_row ($ result )){
$ Rowset [] = $ row;
}
} Else {
$ Rowset = array ();
}