How to insert the recently inserteddata of a table to others DB's Table? See description...

Posted by Parth on Stack Overflow See other posts from Stack Overflow or by Parth
Published on 2010-04-24T06:36:21Z Indexed on 2010/04/24 6:43 UTC
Read the original article Hit count: 133

Filed under:
|
|

I am using MySQL DB and I have created a PHP script for the following, now i need the idea for the below asked question.... please help...

I have a table called audit trail whose structure is:

id, trackid, table, operation, newvalue, oldvalue, field, changedone

I have created triggers for insert/update/delete for every table of same DB, now whenever there is change in ny DB the triggers get activated and updates the Audit trail table accordingly.. I am tracking these changes so that i can use these changes to be done on production DB which is of same structure as of this test DB.

Also when the admin finds that he does not need the changes recently he did for production DB then he can rollback it using the Old Data it stored in Ausittrail table of test db.

Now here in audit trail table structure, there will be an insert for every single field change like-wise if a table has 4 fields then the change in that tavle will insert 4 rows in audit trail..

Coming to the question now, How can i find the latest change done from the Audit table so that I can insert these changes in Production DB.

© Stack Overflow or respective owner

Related posts about mysql

Related posts about auditing