SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    299
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help me with Paging code. It is not working according

    I have problem with a php scripts to do with paging.This code below is not working according.I have set that 10 records are shown per page then another set of 10 on the next. But when I click on next or last link it is not showing next 10 records. Where Iam going wrong.
    Help me with this code.

    <td width="23%" align="center">
    <?php if ($pageNum_de > 0) { // Show if not first page ?>
    <a href="<?php printf("%s?pageNum_de=%d%s", $currentPage, 0, $queryString_de); ?>">First</a>
    <?php } // Show if not first page ?>
    </td>
    <td width="31%" align="center">
    <?php if ($pageNum_de > 0) { // Show if not first page ?>
    <a href="<?php printf("%s?pageNum_de=%d%s", $currentPage, max(0, $pageNum_de - 1), $queryString_de); ?>">Previous</a>
    <?php } // Show if not first page ?>
    </td>
    <td width="23%" align="center">
    <?php if ($pageNum_de < $totalPages_de) { // Show if not last page ?>
    <a href="<?php printf("%s?pageNum_de=%d%s", $currentPage, min($totalPages_de, $pageNum_de + 1), $queryString_de); ?>">Next</a>
    <?php } // Show if not last page ?>
    </td>
    <td width="23%" align="center">
    <?php if ($pageNum_de < $totalPages_de) { // Show if not last page ?>
    <a href="<?php printf("%s?pageNum_de=%d%s", $currentPage, $totalPages_de, $queryString_de); ?>">Last</a>
    <?php } // Show if not last page ?>
    </td>

    When I click on the next or last link iam not seeing any record, but a blank page.
    Iam seeing this URL Before_Travel_Applications_Report.php?pageNum_df=1&totalRows_df=2 where is the php page
    Last edited by zamzam; Apr 21, 2006 at 04:56.

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,510
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    What is the result of these lines of code? Moving the cursor over de links (first, next, etc), what do you see?

  3. #3
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    299
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When I click on the next or last link Iam not seeing any record, but a blank page.

  4. #4
    does not play well with others frezno's Avatar
    Join Date
    Jan 2003
    Location
    Munich, Germany
    Posts
    1,391
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i think what guido2004 means is, what do you see when you just move the cursor above such a link but don't klick at it.
    Usually the result of such a hyperlink is displayed at the bottom line of your browser.
    So you may check this whether is has the correct infos

    On the other hand i'm just wondering how the URL should look like, escpecially the queryString_de variable.
    i have the vague feeling that that's wrong (as well)
    We are the Borg. Resistance is futile. Prepare to be assimilated.
    I'm Pentium of Borg.Division is futile.Prepare to be approximated.

  5. #5
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,510
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Exactly frezno. There might be a problem in the part of code zamzam has posted, in other words that the link created isn't right. But it's impossible to see. Zamzam will have to post the link that is the result of his code. Something like '/pages/currentpage.php?pageNum_de=2'.

    And if the links are constructed like they should be, then the code posted here is working, and the fault must be somewhere else. For example in the code where the pagenumber is read and used to extract the next 10 records from the DB.


Bookmarks

Posting Permissions

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