Skip to main content

MySQL Auto Updating Timestamps

Today I was working with an ExpressionEngine website (which I know nothing about) and I needed to get a modification date on the user profile fields. After searching the ExpressionEngines documentation, I realized that adding my own submit function wasn't going to be as easy as Drupal's hook_form_alter(). My next thought was to try MySQL. After searching a little, I found a post that showed me how to add a timestamp field that updates automatically (http://richard-quinn.net/?p=114).

Basically, the timestamp MySQL format type has a setting that will update the timestamp field whenever the row is updated.

changed_at timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP

Problem solved!


Comments