Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Pagination Help

  1. #1
    New Coder
    Join Date
    Jul 2006
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Pagination Help

    Hi Guys,

    Can anyone possibly help me fix this pagination code?

    It is currently displaying the following:
    PHP Code:
    Showing 10 of 32 parts requests.
    Next Page 
    If you click on number 1 for example, it gives you this:

    PHP Code:
    Showing 10 of 32 parts requests.
    Next Page 

    The problem with the above is its not exactly logical, If you want to go back to the first page you should be pressing number 1 right, but number 1 holds the 2nd set of results (page2)

    Also where it says 'Showing 10 of 32 parts requests' is there a way i can get this to display similiar to google where on page 2 its says 'Showing results 11 - 20 of 32 parts requests'

    The pagination code is coming from these calls:
    PHP Code:
    $total_records mysql_num_rows($result);
    $pages ceil($total_records $rows_per_page);
    mysql_free_result($result);

      
    // if there are more than 1 page run the query like this
    if (!isset($filter))
      
    $filter 0;
      
    $start $filter $rows_per_page 
    And the pagination code:

    PHP Code:
    echo "<font class=\"gen\">Showing $number of $total_records parts requests.</font><br><br>";


    //showing the navigation links . (Previous)
    if ($filter 0) {
      
    $previous $filter 1;
      
    $url $_SERVER['PHP_SELF'] . "?filter=$previous"
       echo 
    "<a href=\"$url\" class='gen'>Prev Page</a>&nbsp;|&nbsp;\n";           
    }


    // page numbering links 
    if ($pages>1) { 
         for (
    $i 1$i $pages$i++) { 
           
    $url $_SERVER['PHP_SELF'] . "?filter=" $i
          echo 
    "  <a href=\"$url\" class='gen'>$i</a> |";   
         }  
    }  



    //showing the navigation links . (Next)
    if ($filter $pages 1) {
      
    $next $filter 1;
      
    $url $_SERVER['PHP_SELF'] . "?filter=$next";  
      echo 
    "<a href=\"$url\" class='gen'> Next Page</a>\n"


  • #2
    New Coder
    Join Date
    Jul 2006
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts
    anyone ?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •