Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using timestamp?

Status
Not open for further replies.

vik1ng

Programmer
Joined
Feb 25, 2005
Messages
4
Location
NO
Hi.. I would like to have a select statement from my table
that makes sure the info I am after is caught for at least 5 minutes after the info is added.

WHY: People on my site can send a message that will put their image on my main page. I have limited the query to show only 5 images. I now want the images to be visable for at least 5 minutes. So my problem is how to make a queue so even if more than 5 rows are added to the table the images still will be visable for at least 5 minutes.

I have a time column in the table with type timestamp(12). I
guess I have to do something with that.
Any Idea anyone on what I could do?
 
How about something like:
[tt]
SELECT mugshot
FROM userdata
ORDER BY timeadded DESC
LIMIT 5
UNION
SELECT mugshot
FROM userdata
WHERE timeadded > NOW() - INTERVAL 5 MINUTE
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top