MySQL Forums :: Newbie :: PHP/MySQL date < CURDATE() problem


Advanced Search

PHP/MySQL date < CURDATE() problem
Posted by: Luke Godfrey ()
Date: December 27, 2007 07:17PM

I'm a new PHP/MySQL programmer, and I'm working on a website for my church. What I'm trying to do is have an "Upcoming Events" thing on the side that automatically selects the seven next events that are coming up. I had no problem, until I decided that it would be nice for it to auto-prune events that had already past.

My events have dates (eg. "2007-12-27") called "date." This worked fine to select events that were today or past:

SELECT * FROM events WHERE date >= CURDATE() ORDER BY date LIMIT 7
Here's the code I wanted to use to prune my table:

DELETE FROM events WHERE date < CURDATE()
Unfortunately, when I use this code, it also deletes events for the same date. What's wrong?

Options: ReplyQuote


Subject Written By Posted
PHP/MySQL date < CURDATE() problem Luke Godfrey 12/27/2007 07:17PM
Re: PHP/MySQL date < CURDATE() problem Luke Godfrey 12/27/2007 07:21PM
Re: PHP/MySQL date < CURDATE() problem Greg Platt 12/28/2007 01:13PM
Re: PHP/MySQL date < CURDATE() problem Greg Platt 12/28/2007 01:16PM
Re: PHP/MySQL date < CURDATE() problem Greg Platt 12/28/2007 01:22PM
Re: PHP/MySQL date < CURDATE() problem Greg Platt 12/28/2007 01:54PM
Re: PHP/MySQL date < CURDATE() problem Brian Papantonio 12/28/2007 02:23PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.