SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Jun 2000
    Location
    Netherlands
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,

    I'm looking for a piece of code to make a "prev|next" item out of searchresults.
    (i.e: so i can display 10 out of 60 results and then click on 'next' to see the next 10 results etc. etc.)
    Does anyone has such a piece of code or is there a tutorial about it?
    Great thanks,

    Joep

  2. #2
    SitePoint Member
    Join Date
    Jun 2000
    Location
    Netherlands
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oeps, sorry. (can i cancel the post?)
    I saw later that Kevin Yank (is it.... yes, it's THE Kevin Yank. The man who knows almost everything about php. ;-)
    posted an answer on such a question on the 5th of August. Let's take a look at that article. www.webmasterbase.com

    Joep

  3. #3
    SitePoint Member
    Join Date
    Jun 2000
    Location
    Netherlands
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Uhh, another reply on my reply...

    I read the article about the LIMIT statement but can't figure out the rest.
    ----------article from site----------
    You can use a LIMIT clause to do this sort of thing by specifying both the result to begin the list with and the maximum number of results to display. The following query, for example, will list the 21st to 25th most popular jokes in the database
    ------------------------------------
    The question is how i can make that 'following query' (using next|prev ?, how)
    Great thanks,

    Joep

  4. #4
    Serial Publisher silver trophy aspen's Avatar
    Join Date
    Aug 1999
    Location
    East Lansing, MI USA
    Posts
    12,939
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Create a counter variable and keep passing it to the next.

    For instance lets say you list 10 results per page, well on the first page create a variable named "counter" and give it a value of 10 and then use that in your limit clause.

    Then do some math functions, Counter+10=Next Counter-10=Prev

    Then pass a variable with your links.

    view.php?Counter=$next

    view.php?Counter=$prev

    Use some if then else statements to insure you dont go lower than 0 or over the total # of results returned, and you should be in business.

    Chris

  5. #5
    SitePoint Zealot
    Join Date
    Feb 2000
    Location
    xyz
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Joep, could you give the exact URL to Kevin's article (Where LIMIT is being discussed). I find this very interesting.


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
  •