The following is a paging example program, which may seem complicated, but you only need to use it to find that everything is so simple: example. php (as the mainstream development language) & lt ;? Php (as the mainstream development language, but you only need to use it to find that "everything is so simple ":)
Example. php (as the mainstream development language)
$ Conn = maid ("test", "123456", "test123 ");
Include_once "pager. inc. php (as the mainstream development language )";
?>
/** Start paging test */
// {Initial paging object
$ Pager = new pager ();
/** Split select id, name, age from test where age> 20 order by id desc */
$ SqlArr = array (conn => $ conn, // Database link
Fields => "id, name, age", // query the subject sentence
Table => "test", // table name
Condition => "age> 20", // query condition
Order => "order by id desc" // sorting method
);
If (! $ Pager-> listn ($ sqlArr, 10, $ page) // 10 entries are displayed on each page.
{
$ Pager-> errno = 10;
Die ($ pager-> errmsg ());
}
//}}}
// {Data Display
For ($ I = 0; $ I <count ($ pager-> result); $ I ++)
{
$ Tmp = $ pager-> result [$ I];
Echo "id:". $ tmp [ID]."
";
Echo "name:". $ tmp [NAME]."
";
Echo "age:". $ tmp [AGE]. ""
}
//}}}
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.