I have some records in the db if I customer delete a record, I use that record id to copy the data from the that table and insert it into an archive table
$sqlarch = "INSERT customers_archive SELECT * FROM customers_record WHERE UCI = '8233379' "
I have some records in the db if I customer delete a record, I use that record id to copy the data from the that table and insert it into an archive table
$sqlarch = "INSERT customers_archive SELECT * FROM customers_record WHERE UCI = '8233379' "
Given only the names of two tables in your database and a possibly misunderstood question in keeping with the comment made regarding a
triggerperhaps the following might be of use.To replicate the
customers_recordtable such that it is suitable to act as anarchivedversion of thecustomers_recordtable you can simply create a clone using:and then create a simple trigger that will populate the new table with a copy of whatever record is deleted using:
You can extend this same logic to act as a log for any action performed on a particular table if you add additional columns to record the type of sql action being performed and also possibly the user which can be useful for audit purposes.