This topic is locked

Copy all fields to archive table before delete

12/31/2008 2:23:05 PM
PHPRunner General questions
vin7102 author

Hello,
I have a table called payroll_main that contains the following fields: id, Employee_ID, Employee_Name, Job_Name, and Shop_Hours.

At the end of each work week, I want to be able check all the records on the "payroll_main" list page and delete them but only after adding all those records to the archive table called "Payroll_archive" , which contains all the same fields except with "_a" added to the end of each field name. (id_a, Employee_ID_a, Employee_Name_a, ect...)
I see the "after group of records deleted" event in the list page of payroll_main, but I dont see anything that states "before group of records deleted".
Thanks for the help

Vince

A
alang 1/4/2009

Can you use "before record deleted" event?

vin7102 author 1/5/2009

Hello,
I believe I could use "Before record deleted" event but I'm not sure how to code it.

J
Jane 1/5/2009

Vince,
here is just a sample:

global $conn,$strTableName;

$strSQLSave = "INSERT INTO AnotherTable (Field1_a, Field2_a) SELECT Field1, Field2 FROM ".$strTableName." where ".$where;

db_exec($strSQLSave,$conn);