I have a database with MySQL. I am doing the log of this database. Most are working, but I can not get the registry id that has been modified.
Example : When changing some data, it should be saved in the log id of the record that was changed, but only NULL
appears. I'm doing them using triggers , and one of them is:
CREATE TRIGGER 'empresa_AFTER_INS' AFTER INSERT ON 'tabela' FOR EACH ROW
insert into 'log'.'log_tabela'(campos_do_banco,data_hora,acao,usuario)
values (NEW.campos_do_banco,NOW(),'insert',@usuario);
How do I make sure that the id
of the data is saved in the logs?