Please enable JavaScript to view this site.

Navigation: Advanced topics > Events > Predefined actions

Events. Save new data in another table

Scroll Prev Next More


Save new data in another table action allows copying added or modified data to another table. This table should be a part of the project.


Available in the following events:

Add page: Before record added

Edit page: Before record updated



Note: change red values to adjust the action code to your project.

The name "copy_of_cars" stands for the table where the new data is saved.

Example 1. Direct SQL query


//**********  Save new data in another table  ************
// note: text field values need to be wrapped by single quotes
$sql = "INSERT INTO copy_of_cars (make, model, price) values (";
$sql .= "'".$values["make"]."',";
$sql .= "'".$values["model"]."',";
$sql .= $values["price"];
$sql .= ")";

Example 2. Database API


//**********  Save new data in another table  ************
$data = array();
$data["make"] = $values["make"];
$data["model"] = $values["model"];
$data["price"] = $values["price"];
DB::Insert("copy_of_cars", $data );

See also


Database API

Database API: Insert        

Save old data in another table

Insert a record into another table


Created with Help+Manual 7 and styled with Premium Pack Version 3 © by EC Software