This topic is locked
[SOLVED]

 Add Primary Key to another table

2/18/2018 11:36:11 AM
PHPRunner General questions
P
PaulM author

I'm using the after record added event trying to add the primary key to another table but it fails. I can add any other field but the primary key doesn't want to work. I've so far tried:
$sql = "INSERT INTO Property_Landlord_Tenant_Link (PLT_P_id) values ($values[P_id])";

CustomQuery($sql);
$sql = "INSERT INTO Property_Landlord_Tenant_Link (PLT_P_id) values ($keys[P_id])";

CustomQuery($sql);
I can hard code a value and that workss but need $values[P_id] or $keys[P_id] to work.

romaldus 2/18/2018


$sql = "INSERT INTO Property_Landlord_Tenant_Link (PLT_P_id) values ('".$values[P_id]."')";

CustomQuery($sql);
P
PaulM author 2/18/2018

Thank you very much romaldus, that has worked.




$sql = "INSERT INTO Property_Landlord_Tenant_Link (PLT_P_id) values ('".$values[P_id]."')";

CustomQuery($sql);