TapeGun007 Posted August 18, 2011 Share Posted August 18, 2011 I'm simply using PHPMyAdmin until I get the php code finished, but I'm trying to do an Update command. Here is what I have so far: Update Backup_Of_Leads SET Date='2011-08-18' WHERE Date<'2011-08-18' Anything that is before today's date, I want to reset to today's date. Obviously my simple command above doesn't work. Any help? Quote Link to comment https://forums.phpfreaks.com/topic/245087-updating-the-date/ Share on other sites More sharing options...
Network_ninja Posted August 18, 2011 Share Posted August 18, 2011 simply because you use the name "Date" in your fieldname..... You cannot use that for fieldname because it's a reserve word. You can see the complete reserve words here: http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html Quote Link to comment https://forums.phpfreaks.com/topic/245087-updating-the-date/#findComment-1258912 Share on other sites More sharing options...
Pikachu2000 Posted August 18, 2011 Share Posted August 18, 2011 DATE is not a MySQL reserved word. The problem has to lie elsewhere. What is the data type of that field? Quote Link to comment https://forums.phpfreaks.com/topic/245087-updating-the-date/#findComment-1258981 Share on other sites More sharing options...
PFMaBiSmAd Posted August 18, 2011 Share Posted August 18, 2011 my simple command above doesn't work. What result, error, or other symptom did you observe that leads you to believe it did not work? There's nothing technically wrong with that query. Quote Link to comment https://forums.phpfreaks.com/topic/245087-updating-the-date/#findComment-1259015 Share on other sites More sharing options...
TapeGun007 Posted August 18, 2011 Author Share Posted August 18, 2011 Well... duh... I wrote that while I was tired and it was late, and I went right to bed afterwards. I had thought about "date" being a potential reserved word, and changed it to FollowUpDate. Sorry guys, I'll go back and try it again with the correct table name. Quote Link to comment https://forums.phpfreaks.com/topic/245087-updating-the-date/#findComment-1259025 Share on other sites More sharing options...
TapeGun007 Posted August 18, 2011 Author Share Posted August 18, 2011 Just to confirm, I used Update Backup_Of_Leads SET FollowUpDate='2011-08-18' WHERE FollowUpDate<'2011-08-18' And it worked fine. hehe. *egg on face* Quote Link to comment https://forums.phpfreaks.com/topic/245087-updating-the-date/#findComment-1259026 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.