I know there’s this statement ON UPDATE, is there a way to use it to create a column in my database and when this value change, another predefined value is set to 0 ?
Thanks in advance.
Exemple:
id | value | type
1 2 5
2 4 6
3 7 8
if i update the value of the first row, i want the type to set automaticaly to 0.
You need to create a trigger that gets executed for every time row changed, for example:
After this, for everytime you do query:
If the value is different that the old one, trigger will gets executed and type will be set to
0Here’s how to set trigger from phpMyAdmin: