SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    [Call me Bram] iBram007's Avatar
    Join Date
    Feb 2001
    Location
    Belgium
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Next / previous topic

    I'm write a message board at the moment, and I have a problem with my thread view. I want a link while viewing a thread to the next and the previous topic. I suppose I have to sort the thread table on posttime, but how do I jump to the next and previous? Is that something like this:

    select * from $table[threads] where forumid='$currentforumid' and threadid='$currentthreadid' order by posttime desc

    I suppose I have to now jump to the row +1 and -1, but how do I do that?

  2. #2
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Basically, when you query your database, do soemthing like

    LIMIT $offset,$limit

    whereby $offset and $limit are the deciding variables for where to start and end (of rows in the table) the query.

    look to the article at www.phpbuilder.com which addresses this problem.

    http://www.phpbuilder.com/columns/rod20000221.php3
    http://www.phpbuilder.com/columns/rod20001214.php3
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein


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
  •