<?
/* ==== 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 "<font face = arial size = 2> | top 10 pages | <a href = \" $ pagename. php? Newpage10 = 2 & page = 11 \ "> page $ page_endx </A> | </FONT> ";
} Else {
$ Page_end = 10;
Echo "<font face = arial size = 2> | the top 10 pages | <a href = \" $ pagename. php? Newpage10 = 2 & page = 11 \ "> next 10 pages </A> | </FONT> ";
}
} Elseif ($ newpage10> 1 ){
If ($ newpage10 === page10 & ($ total_page % 10 ))
{$ Page_end = $ total_page % 10;
Echo "<font face = arial size = 2> | <a href = \" $ pagename. php? Newpage10 = ". ($ newpage10-1 ). "& page = ". ($ newpage10-2) * 10 + 1 ). "\"> Top 10 pages </A> | the last $ page_end page | </FONT> ";
} Else {
If ($ newpage10 ==( $ page10-1) & ($ total_page % 10 ))
{$ Page_endx = $ total_page % 10;
$ Page_end = 10;
Echo "<font face = arial size = 2> | <a href = \" $ pagename. php? Newpage10 = ". ($ newpage10-1 ). "& page = ". ($ newpage10-2) * 10 + 1 ). "\"> Top 10 pages </a> | <a href = \ "$ pagename. php? Newpage10 = ". ($ newpage10 + 1 ). "& page = ". ($ newpage10 * 10 + 1 ). "\"> page $ page_endx </A> | </FONT> ";
} Else {
$ Page_end = 10;
Echo "<font face = arial size = 2> | <a href = \" $ pagename. php? Newpage10 = ". ($ newpage10-1 ). "& page = ". ($ newpage10-2) * 10 + 1 ). "\"> Top 10 pages </A> | <a href = \ "$ pagename? Newpage10 = ". ($ newpage10 + 1 ). "& page = ". ($ newpage10 * 10 + 1 ). "\"> next 10 pages </A> | </FONT> ";
}
}
}
}
// ---------------------- Page number per ten pages --------------------------------------
Echo "Total:". $ total_row. "entry ";
For ($ n = $ page_begin + 1; $ n <= $ page_begin + $ page_end; $ n ++ ){
Echo "<a href = $ pagename. php? Newpage10 = $ newpage10 & page = $ n >$ n </a> ";
}
Echo "page ";
?>