So I've got a simple query in MySQL that sets a new member's expiration date once they pay their dues:
UPDATE members SET joined=CURDATE(), expires=DATE_ADD(CURDATE(), INTERVAL 1 YEAR), active='1' WHERE id=1000
this query has run 200+ times, normally with the correct result - the current date is put in the joined field, and a year from that date in the expires field. However, in about 10 instances, the expires date has been set to 00-00-0000 with no obvious explanation. I started writing the query to a text file every time to make sure the syntax was correct and I hadn't missed anything - and I didn't - it's exactly that query (with only the ID varying) for every query, those that work, and those that don't.
The only thing I can think here is that there must be an issue with MySQL's DATE_ADD function. Has anyone else experienced anything like this?
UPDATE: I should add that the joined field is correct with the current date in the cases where the expires date is incorrect.
- I'm using MySQL 5.0.81.
- There are no triggers.
- The table is using MyISAM.
IMPORTANT UPDATE: I'm an idiot - when I say 11-30-1999 that's not actually what's in the database. I absent-mindedly wrote that, but in fact the database contains the value 00-00-0000 - 11-30-1999 is just how it gets rendered by PHP onto my page. Sorry about that, hopefully that will make this problem less difficult to figure out.