Jump to content

Audit Trail, database triggers?


dmccabe

Recommended Posts

i have asked this before I think, but it was a long time ago.

 

i am creating a database for work and I need to create an audit trail of who did what.

 

Is there anyway to set up triggers on a mySQL database so that when a field is update it captures certain information in to another table in the database?

Link to comment
https://forums.phpfreaks.com/topic/146088-audit-trail-database-triggers/
Share on other sites

i worked it out na na na lol.

 

example from mchi link very nice!

 

drop tables a,b;

create table a(i int);

create table b(n int default 0);

insert into b values(0);

 

create trigger ainsert before insert on a for each row

update b set n=n+new.i;

 

insert into a values(1);

select * from b;

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.