Select from timestamp column

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
TheOracle
Forum Commoner
Posts: 64
Joined: Mon Nov 22, 2004 4:56 am
Location: Bedford, UK

Select from timestamp column

Post by TheOracle »

OK, bit out of my depth now on this app I'm trying to build.

I have a table with a timestamp column which is automatically updated with now() when the records are inserted.

However, on the page where I want to be able to view the info I need to give the option to view info from within a certain amount of time.

So in the select I need to put something like:

Code: Select all

where timestamp < now() + 28
But I'm quite sure this won't work. Is there a better way?

Can anyone also offer some guidance on providing a "delete" link for each of the records returned. They do have a unique ID

Many thanks in advance
User avatar
xisle
Forum Contributor
Posts: 249
Joined: Wed Jun 25, 2003 1:53 pm

Post by xisle »

something like this..

Code: Select all

timestamp > DATE_SUB(NOW(), INTERVAL 1 MONTH)
lookup date_add() as well at mysql.org,
not sure which one you need
Post Reply