I'm trying to insert to multiple children table from one parent table.
I am able to use After Add and the following code for 1 parent and 1 child table, but having difficulty with 1 parent and multiple children.
Below is my code:
global $conn;
{
$id = mysql_insert_id();
{
$strSQLInsert = "insert into stf_staffdetails (StaffID,SeniorityDate,SeniorityHours,OfficeSeniorityDate,MyStatus,MyPosition, Address,ApartmentNumber,City,PostalCode,Telephone,SecurityAccessNumber) values (".$id.", '".$values["SeniorityDate"]."', '".$values["SeniorityHours"]."', '".$values["OfficeSeniorityDate"]."', '".$values["MyStatus"]."', '".$values["MyPosition"]."', '".$values["Address"]."', '".$values["ApartmentNumber"]."', '".$values["City"]."', '".$values["PostalCode"]."', '".$values["Telephone"]."', '".$values["SecurityAccessNumber"]."')";
$strSQLInsert1= "insert into stf_contact (StaffID,EmergencyContactName,ContactPhone,AlternateContactName,AlternateContact
Phone, Relationship) values (".$id.", '".$values["EmergencyContactName "]."', '".$values["ContactPhone "]."', '".$values["AlternateContactName "]."', '".$values["AlternateContactPhone "]."', '".$values["Relationship "]."')";
$strSQLInsert2= "insert into stf_parking (StaffID,PlateNumber,PlateNumber2,BluePassNumber,GatePass, VehicleMake) values (".$id.", '".$values["PlateNumber "]."', '".$values["PlateNumber2 "]."', '".$values["BluePassNumber "]."', '".$values[",GatePass "]."', '".$values["VehicleMake "]."')";
db_exec($strSQLInsert,$conn);
db_exec($strSQLInsert1,$conn);
db_exec($strSQLInsert2,$conn);
}
}
Thanks for your help.