& Lt ;? * Display data records by page a page with 10 consecutive pages connected to one page can display $ limit_row record information with the following 10 pages and top 10 pages turning functions ------ required input value $ total_row; $ limit_row; $ pagename; ----- $ tot /* ==== Display data records by page ====
A page has ten consecutive page connections
$ Limit_row record information is displayed on one page.
It also has the following 10 pages and top 10 pages flip function
==========================================
------ Value $ total_row; $ limit_row; $ pagename ;-----
$ Total_row indicates the total number of rows in the selected query results.
$ Limit_row indicates the maximum number of lines displayed on each page.
$ Pagename indicates the name of the returned display page. (Without suffix)
----------------------------------------------------
----------------------------------------------------
$ Page current read page
$ Total_page can be divided into several pages.
$ Row_begin indicates the number of rows to read.
$ Row_end indicates the number of rows read.
-----------------------------------------------------*/
If (! $ Page) {$ page = 1 ;}
$ Total_page = ceil ($ total_row/$ limit_row );
$ Row_begin = $ limit_row * ($ page-1 );
If ($ page = $ total_page & ($ total_row % $ limit_row )){
$ Read_row = ($ total_row % $ limit_row );
} Else {$ read_row = $ limit_row ;}
If ($ total_page <= 10 ){
$ Page_begin = 0;
$ Page_end = $ total_page;
$ Page10 = 1;
$ Newpage10 = 1;
} Else {
// -------------- Display the next 10 pages by page ----------------
// $ Page10 contains dozens of pages in total
// $ Newpage10 is the starting position for reading ten pages
// $ Page_endx indicates the last page number to be read.
$ Page10 = ceil ($ total_page/10 );
If ($ newpage10 = "") {$ newpage10 = 1 ;}
$ Page_begin = 10 * ($ newpage10-1 );
If ($ newpage10 = 1)
{
If ($ newpage10 ==( $ page10-1) & ($ total_page % 10 ))
{
$ Page_endx = $ total_page % 10;
$ Page_end = 10;
Echo "| top 10 pages | page $ page_endx | ";
} Else {
$ Page_end = 10;
Echo "| the top 10 pages | the next 10 pages | ";
}
} Elseif ($ newpage10> 1 ){
If ($ newpage10 === page10 & ($ total_page % 10 ))
{$ Page_end = $ total_page % 10;
Echo "| top 10 pages | the last $ page_end page | ";
} Else {
If ($ newpage10 ==( $ page10-1) & ($ total_page % 10 ))
{$ Page_endx = $ total_page % 10;
$ Page_end = 10;
Echo "| top 10 pages | page $ page_endx | ";
} Else {
$ Page_end = 10;
Echo "| top 10 pages | Next 10 pages | ";
}
}
}
}
// ---------------------- Page number per ten pages --------------------------------------
Echo "total:". $ total_row. "entry ";
For ($ n = $ page_begin + 1; $ n <= $ page_begin + $ page_end; $ n ++ ){
Echo "$ n ";
}
Echo "page ";
?>