To track changes to specific fields in your database, perhaps?

There is a table in the database, is there a way to track what has varied particular field and only it! Let's say we have a table with fields name, phone, city. Need to keep track of the city box. If changing the name or the phone, not the event, but if changing the box city event is and it need to track? As it is possible to do this?
April 19th 20 at 12:41
3 answers
April 19th 20 at 12:43
Solution
Use triggers:

CREATE TRIGGER `after_update_table_name` AFTER UPDATE ON `table_name`
 FOR EACH ROW BEGIN

 IF `OLD`.`field_name` <> `NEW`.`field_name` THEN
 # Your action
 END IF;

END


https://dev.mysql.com/doc/refman/8.0/en/trigger-sy...
April 19th 20 at 12:45
to use triggers
April 19th 20 at 12:47
Trigger on field change and record in a separate table of amendments.
I don't understand how to trigger the right to write)
if update tablename (how to specify a specific field)
insert into logs value(vol, vol, vol)

field how to specify? - Melisa.Reilly commented on April 19th 20 at 12:50
@Melisa.Reilly, IF OLD.fielf <> NEW.field - Tyshawn30 commented on April 19th 20 at 12:53

Find more questions by tags SQLPHP