PHP paging, what to do with

Source: Internet
Author: User
PHP Paging


$pageCount = 9;//Total Pages
$pageNow = number of pages entered by the 3;//user
$i = number of pages displayed 3;//
$j = $pageCount/$i; Number of times you can scroll
$arr =array ();

Number of controls to scroll
for ($k =0; $k < $j; $k + +) {

Control page Flipping
if ($pageNow ==3* $k) {

for ($e = ($k) +1; $e <=3* ($k + 1); $e + +) {

$arr [] = $e;
Echo $e;
}
echo "
";
}else {
Output currently displayed pages
for ($a =0; $a < $i; $a + +) {
$arr [$a];

}

}
}

?>
Help to see, there is a problem.





------Solution--------------------
PHP Code
$pageCount = 9;//Total pages $pagenum = 3;//The number of page numbers displayed $pagenow = $_get[' page ']? $_get[' page ': 1;//the number of pages entered by the user if ($pageNow = = $pageCount) $pageNow = 1; Cyclic scrolling, plus this sentence $pagestart = floor ($pageNow/$pageNum) * $pageNum + 1; The starting page number displayed $pageend = $pageStart + $pageNum;//The ending page number +1for ($i = $pageStart; $i < $pageEnd; $i + +)  
  • Contact Us

    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.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.