Skip to content
Advertisement

Mysql update date relative to specific column update

I have a users_settings table on my db in which I store some data about the user. For some of that data I need to keep track of last modification, for example:

When I update the row with a new feel value I want to automatically write the current timestamp, is it possible to achieve this directly from mysql or I need to set the timestamp directly in the update query from my backend?


Update 1

As suggested I need to use a trigger, I written this trigger but there is some syntax error, can you help me to identify the error?

UPDATE 2

Now, thanks to James answer I created the trigger, it works well

Advertisement

Answer

You can use the below trigger on BEFORE UPDATE

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement