PHP & MySQL Pagination Update Help

前端 未结 5 1054
广开言路
广开言路 2020-12-19 16:04

Its been a while since I updated my pagination on my web page and I\'m trying to add First and Last Links to my pagination as well as the ...

5条回答
  •  無奈伤痛
    2020-12-19 16:14

    Just get the total and backtrack:

    $result_count = 200; // hypothetical
    
    // run your regular code.....
    
    $end_pages_to_display = 3;
    
    for($i = $result_count; $i <= ($result_count - $end_pages_to_display); $i--)
    {
        echo "{$i}";
    }
    

    I mean... it's not the code that's going to work for your site, but it's the exact same logic.

提交回复
热议问题