Small bug in paging function
iUnicorn
iUnicorn 2019-04-12 19:15:41
0
6
2082

Hello Teacher Zhu, there is a small bug in your paginated course (about 16 minutes into the video course). The page number jumps to 1, but the actual data still displays the content on page 2. And why? It will not change even if you click it. You have to manually change the p value to 0 in the URL column to jump back to page 1. How to solve it? ?

iUnicorn
iUnicorn

知识,成就梦想!

reply all (3)
--

$Previous = ($page - 1)<1?1:($page-1); //Prevent the previous page from overflowing


##

Then call this $Previous variable and do not perform calculations in the tag, then there will be no problem.

  • reply grateful
    999 author 2019-10-12 19:40:15
iUnicorn

Teacher, why have I changed two browsers and still can’t reply the code to the website? The reply button is not reflected when clicked..., website BUG?

    Peter-Zhu

    This is a second-year course, and the details are difficult to recall. You can post the code and everyone will help you analyze it

    • reply The code in the course was calculated twice, resulting in a BUG. if($page<=1){ $page = $page +1; } echo 'Previous page'; //When it is 1, the value of $page will become 2 through the above calculation.
      -- author 2019-05-29 21:29:58
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!