1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Check for the nth post - count

Discussion in 'XenForo Questions and Support' started by trilogy33, Apr 4, 2011.

  1. trilogy33

    trilogy33 Well-Known Member

    I want to check for the 2,000th post on my board.
    Is this going to be a db query?
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Hmmm, this is easy for a thread as you just change the ID to 2000 but for a post it needs the thread ID.

    I can't find an obvious way of doing it without querying the DB.
  3. trilogy33

    trilogy33 Well-Known Member

    Got it, just did it the easy way.
    MySQL > xf_post and look for the id :)
  4. Brogan

    Brogan XenForo Moderator Staff Member

    Hehe, when in doubt... ;)
    trilogy33 likes this.
  5. James

    James Well-Known Member

    trilogy33 and Brogan like this.
  6. Brogan

    Brogan XenForo Moderator Staff Member

    Here Paul, have one of these facepalm.gif

    I knew it was possible but couldn't remember how.
  7. trilogy33

    trilogy33 Well-Known Member

    Oh gawd! :ROFLMAO:
    You live and learn. /* Tries to seem all nonchalant */
  8. Onimua

    Onimua Well-Known Member

    Quick, screenshot this moment is it may never happen again! :LOL:
  9. Brogan

    Brogan XenForo Moderator Staff Member

    *deletes thread...*

    I think I need to defragment....too many posts now.
  10. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Note that selecting the 2000th post by postid will ignore gaps in the postid values. Gaps are created when posts are deleted.

    This query will select the 2000th post record of the posts that currently exist:

    SELECT *
    FROM xf_post
    ORDER BY post_id
    LIMIT 1999, 1
    One method is not more correct than the other. It just depends on how you want to identify the 2000th post.
    trilogy33 likes this.

Share This Page