Paging Problems

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • daveeboi
    New Member
    • Oct 2007
    • 18

    #16
    Originally posted by code green
    Your not quite there with this.[PHP]if (!empty($pagenu m))
    {
    $pagenum = 1;
    }
    echo $pagenum;[/PHP] empty returns true if the variable is empty and NOT will flip this. Try to be a little more diligent [PHP]if (empty($pagenum ))
    {
    $pagenum = 1;
    }
    echo $pagenum;[/PHP]
    Sorry, I don't understand what you mean with the last post. Could you explain please.

    Comment

    • code green
      Recognized Expert Top Contributor
      • Mar 2007
      • 1726

      #17
      Your test is asking
      Code:
      If pagenum is NOT empty, set pagenum to 1
      I have re-written to say
      Code:
      If pagenum IS empty, set pagenum to 1
      The only difference is the '!' meaning NOT

      Comment

      • daveeboi
        New Member
        • Oct 2007
        • 18

        #18
        Originally posted by code green
        Your test is asking
        Code:
        If pagenum is NOT empty, set pagenum to 1
        I have re-written to say
        Code:
        If pagenum IS empty, set pagenum to 1
        The only difference is the '!' meaning NOT
        Oops, sorry I didn't see the adjustment. Just put that in and that has given pagenum an initial value now, when I clicked onto the 2nd page pagenum value was 22!

        Comment

        • code green
          Recognized Expert Top Contributor
          • Mar 2007
          • 1726

          #19
          22? I assume these are the offending lines. [PHP]$next = $pagenum+1;
          echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$next '>Next -></a> ";[/PHP] Then pagenum must be 21.
          You haven't changed the hyperlink string to how I suggested.
          It's probably OK it is just not the way I write them.
          When using mathematical operators always ensure all variables are initialised.
          If not they may contain spurious data.
          This may not be the problem.
          I cannot spot the problem so I suggest echoing out the variables throughout to see where their values are changing
          Last edited by code green; Oct 5 '07, 02:08 PM. Reason: Mistake

          Comment

          Working...