Private $ each_disNums; // Number of Entries displayed on each page
Private $ nums; // The total number of items.
Private $ current_page; // the currently selected page
Private $ sub_pages; // The number of pages displayed each time
Private $ pageNums; // total number of pages
Private $ page_array = array (); // used to construct an array of pagination
Private $ subPage_link; // The link of each page
Private $ subPage_type; // type of the display page
/*
_ Construct is the SubPages Constructor used to automatically run classes when they are created.
@ $ Each_disNums number of entries per page
@ Nums total number of entries
@ Current_num the selected page
@ Sub_pages the number of pages displayed each time
@ SubPage_link: the link of each page
@ SubPage_type: type of the display page
Normal paging mode when @ subPage_type = 1
Example: a total of 4523 records are displayed. 10 records are displayed on each page. Currently, page 1/453 [Homepage] [Previous Page] [Next Page] [last page]
$ SubPages = new SubPages ($ page_size, $ nums, $ pageCurrent, $ sub_pages, "a. php? P = ", 2 );
?>
If (empty ($ _ GET ["p"])
{
$ PageCurrent2 = 0; // limit starts from 0
$ Page_size2 = 3; // ends at 2. three pieces of data are displayed on each page.
}
Else
{$ PageCurrent2 = $ _ GET ["p"] * 3-3; // calculate the first parameter at the beginning of each page.
$ Page_size2 = $ pageCurren2 + 3; // Three data entries are displayed on each page.
}
$ SQL = "select * from art ";
$ SQL = sprintf ("% s limit % d, % d", $ SQL, $ pageCurrent2, $ page_size2 );
$ Ni = new Mysql ("127.0.0.1", "root", "123", "school ");
Echo"
";
$ Sql2 = "select * from art ";
$ Nums = $ ni-> Number ($ sql2 );
// Echo "QQ". $ nums;
$ Result = $ ni-> Query ($ SQL );
While ($ rows = $ ni-> fetch_array ($ result ))
{
Echo"
";
Echo $ rows ['title'];
Echo"
";
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.