MySQL Queries before NOW

Coolzrock

New Member
Now I've read on this fantabulous site about how to check if the timestamp that is in your database is before now(), and that answers part of my question.But the remainder of my question still eludes me:How can you not only check for timestamps BEFORE now(), but also put a cap on how many before now are queried?I have a database that is acting as a guestbook, and the output is a flash piece that looks like a post-it board. you fill out a form, and the submission immediately "tacks" itself to the post-it board. The problem is that when you first load the page, it will load every single post starting from id-0 to id-5,000,000 and so on and so forth.I would like to put a cap on how many are loaded so the query looks at the following things:\[quote\] What's the current timestamp?
Go back in time (for example) 10 entries ago
Post from THAT point on\[/quote\]The fields I have in my database are: id, comments, timestampEDIT
I'm looking at some of the answers, and I would like to ask about the LIMIT. If I put a limit on the queries, will I still be able to query posts that are PAST now? Example: Say there are two people viewing the site at the same time. One visitor posts a comment into the database. I want person 2 to still be able to the see that comment pop up on his end.The flash post-it area runs off a php script that queries the database and exports it into an XML format that Flash can read. Every 5 seconds, the flash re-queries the database to check for more posts.If I put the Limit on the query, will I still be able to grab NEW entries on the fly? I just want the LIMIT to generate a starting point offset from ground zero
 
Back
Top