In the PHP tutorial +mysql Tutorial Database tutorials in the paging code than the previous ASP tutorials, the ASP.net tutorial is relatively easy, because MySQL support limit,0,n so that you can easily and quickly get the records to read, so let's look at the example
function GetPage ($talbe, $choose, $url) {
Global $page, $db, $sortname;
$query = $db->query ("select * from $talbe $choose");
$total = $db->num_rows ($query);
$totalpage =ceil ($total/25);
$nextpage = $page +1;
$uppage = $page-1;
if ($nextpage > $totalpage) $nextpage = $totalpage;
through the page of the code we can see the original PHP page is very simple, as long as get[page] page, the current page, and then use the $page* $pagesize to start, after the end of the $pagesize OK. The MySQL statement is $sql = "SELECT * FROM t limit $page * $pagesize, $pagesize";
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.