refiking Posted January 24, 2009 Share Posted January 24, 2009 I need the most simple method to get this accomplished. DB Field is timestamp and the name is date_commit. I can not do an autoupdate for this field, either. It only needs to be updated at certain times. Not everytime the record is modified. Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted January 24, 2009 Share Posted January 24, 2009 When you want to update it use NOW() as the value in the query Quote Link to comment Share on other sites More sharing options...
Mchl Posted January 24, 2009 Share Posted January 24, 2009 UPDATE table SET date_commit = NOW() Quote Link to comment Share on other sites More sharing options...
refiking Posted January 24, 2009 Author Share Posted January 24, 2009 should it be NOW() or 'NOW()' Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted January 24, 2009 Share Posted January 24, 2009 Either (i think), it might read 'NOW()' literally though Quote Link to comment Share on other sites More sharing options...
Mchl Posted January 24, 2009 Share Posted January 24, 2009 Without quotes. It's the name of MySQL function. If you put quotes around it, MySQL will think it is string. Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted January 24, 2009 Share Posted January 24, 2009 Are you sure it doesn't parse the code like PHP does, and run the function instead of reading it literal Quote Link to comment Share on other sites More sharing options...
Mchl Posted January 24, 2009 Share Posted January 24, 2009 Just tested it on DATETIME field. I'm pretty sure result on TIMESTAMP will be the same. Quote Link to comment Share on other sites More sharing options...
revraz Posted January 24, 2009 Share Posted January 24, 2009 Try it and see. Are you sure it doesn't parse the code like PHP does, and run the function instead of reading it literal Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted January 24, 2009 Share Posted January 24, 2009 Btw if this is solved then click solved in the bottom left of the thread. Quote Link to comment 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.