I hope this is the right place for this. Sorry if it isn't.
I've quite desperate now to get this problem sorted out.
I am trying to write an SQL statement that will pull out all records in a database where the date is higher than or equil to the current date. I have this:
"SELECT * FROM `events` WHERE `from` >= NOW() ORDER BY `from` ASC LIMIT 1"
'from' is a date field (not datetime).
Which seamed to work until Tuesday. The script was meant to drop the current event and replace it with the next in line. Well, it did it on Monday instead. Does anyone have any ideas on how I can get this to work properly?
MySQL problem with a Date field
Moderator: General Moderators
-
SteveMellor
- Forum Commoner
- Posts: 25
- Joined: Mon Jun 26, 2006 7:43 am
-
SteveMellor
- Forum Commoner
- Posts: 25
- Joined: Mon Jun 26, 2006 7:43 am
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
I can't reproduce your problem:
Code: Select all
mysql> SELECT '2007-04-13' >= '2007-04-13';
+------------------------------+
| '2007-04-13' >= '2007-04-13' |
+------------------------------+
| 1 |
+------------------------------+
1 row in set (0.00 sec)
mysql> SELECT '2007-04-12' >= '2007-04-13';
+------------------------------+
| '2007-04-12' >= '2007-04-13' |
+------------------------------+
| 0 |
+------------------------------+
1 row in set (0.00 sec)
mysql> SELECT '2007-04-14' >= '2007-04-13';
+------------------------------+
| '2007-04-14' >= '2007-04-13' |
+------------------------------+
| 1 |
+------------------------------+
1 row in set (0.00 sec)-
SteveMellor
- Forum Commoner
- Posts: 25
- Joined: Mon Jun 26, 2006 7:43 am
-
SteveMellor
- Forum Commoner
- Posts: 25
- Joined: Mon Jun 26, 2006 7:43 am