I have a datetime
column called create_date
. When I create a row, I enter the date NOW().
However, when I update a row my create_date
column automatically updates to NOW(). Even if I was setting different columns and not touching create_date
, it still gets updated. How can I stop this behavior?
Found this doc, but it doesn't explain how to stop the automatic updating. http://dev.mysql.com/doc/refman/5.0/en/timestamp-initialization.html
Try changing the schema so that it uses the DEFAULT clause, which sets it on creation but not on an update: