PHP & MySQL Pagination Update Help

前端 未结 5 1059
广开言路
广开言路 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:25

    I am not sure what your 's' and 'p' $_GET variables are for (salt and pepper?), so i am just working with the 'p', for page.

     1) {
    
        echo '

    '; $current_page = ($start/$display) + 1; //add this here... first will always be one echo 'First'; if ($current_page != 1) { echo 'Previous '; } for ($i = 1; $i <= $pages; $i++) { if ($i != $current_page) { echo '' . $i . ' '; } else { echo '' . $i . ' '; } // add this here... if ( $i == $max){ // stop the for() loop break; // not so fancy way of displaying last two pages, use other example if you want to get fancy. echo ''.($pages - 1).' '; echo ''.($pages).' '; } } if ($current_page != $pages) { echo 'Next'; } echo 'Last'; echo '

    '; } ?>

提交回复
热议问题