SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Thread: add numbers

  1. #1
    SitePoint Zealot
    Join Date
    Apr 2005
    Location
    Auckland, New Zealand
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    add numbers

    hi im tryin to get my script so that when the address bar says ?offset=0 that my link will say offset=20 and when the addreess bar says ?offset=20 link says offset=40 and so on this is what ive got so far but it doesnt seem to work

    echo "<br><br><p align=\"right\"><a href=\"?page=main&off= ($offset+20)\">Next 10</a>&nbsp;&nbsp;&nbsp; <a href=\"?page=main&off=0\">Prev 10</a></p>";

  2. #2
    SitePoint Addict Quaint's Avatar
    Join Date
    May 2004
    Location
    Netherlands
    Posts
    219
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It has to do with your formatting. Try this:

    PHP Code:
    $nextoffset $offset+20;
    $prevoffset $offset-20;
    echo <<<EOF
    <br>
    <br>
    <p align="right"><a href="?page=main&off=
    {$nextoffset}">Next 10</a> &nbsp;&nbsp;&nbsp; <a href="?page=main&off={$prevoffset}">Prev 10</a></p>
    EOF; 
    DO change the values of the $nextoffset and $prevoffset variables

    Quaint Tech
    - Blog on web development and web technology.

  3. #3
    SitePoint Zealot
    Join Date
    Apr 2005
    Location
    Auckland, New Zealand
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that works perfectly thank you

  4. #4
    SitePoint Addict Quaint's Avatar
    Join Date
    May 2004
    Location
    Netherlands
    Posts
    219
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sure thing chief

    Quaint Tech
    - Blog on web development and web technology.

  5. #5
    SitePoint Zealot
    Join Date
    Apr 2005
    Location
    Auckland, New Zealand
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    another thing how would i go about only showing prev 10 if $offset was greater than 0? ive got this
    if($offset >$h) {
    echo "more than zero";
    }
    else {
    echo "less"; }

    but it wont work

  6. #6
    SitePoint Zealot
    Join Date
    Apr 2005
    Location
    Auckland, New Zealand
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    o and $h is set to 0

  7. #7
    SitePoint Zealot
    Join Date
    Apr 2005
    Location
    Auckland, New Zealand
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sory bout dat i just figured it out thanx anyway :P


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
  •