Forum Moderators: coopster

Message Too Old, No Replies

expired article - comparing today to expire date

         

mooger35

7:12 pm on Mar 15, 2006 (gmt 0)

10+ Year Member



On my front page I have a list of articles that are pulled from my database. I have just added a column (expires) to the db in order to remove outdated articles.

I'd like to compare today's date to the expires date in my WHERE statement to exlude all articles where the expires date is older than today. But I'm at a loss right now on getting it to work.

barns101

8:15 pm on Mar 15, 2006 (gmt 0)

10+ Year Member



Assuming that the "expires" column is a Unix timestamp:


SELECT * FROM `articles` WHERE `expires` > UNIX_TIMESTAMP()

mooger35

8:19 pm on Mar 15, 2006 (gmt 0)

10+ Year Member



ya that's what I was trying but it doesn't work.

edit: `expires` is in date format

whoisgregg

8:29 pm on Mar 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



SELECT * FROM `articles` WHERE `expires` > CURRENT_DATE

mooger35

8:33 pm on Mar 15, 2006 (gmt 0)

10+ Year Member



perfect!

thank you very much