This topic is locked

Updating multiple tables when a record is changed/added

3/19/2020 9:48:04 AM
PHPRunner General questions
J
jonlp author

Greetings,
I understand, that I can leverage Events function (such as Custom Record update or After record updated) in PHPRunner to do this but I cannot get it work.
Here is the background, I have 2 tables: A and B. The primary key for table A is "owner", table B also has a "owner" field but it is not a primary key. When a record is changed in table A, I wan to update specific fields for a record in table B that has the same "owner" as table A. The same thing is true if a new record is added to table A, I want a new record to be added to table that has the same "owner.
Any assistance on this would be greatly appreciated...
Thank you in advance.

A
ayctech 3/19/2020



Greetings,
I understand, that I can leverage Events function (such as Custom Record update or After record updated) in PHPRunner to do this but I cannot get it work.
Here is the background, I have 2 tables: A and B. The primary key for table A is "owner", table B also has a "owner" field but it is not a primary key. When a record is changed in table A, I wan to update specific fields for a record in table B that has the same "owner" as table A. The same thing is true if a new record is added to table A, I want a new record to be added to table that has the same "owner.
Any assistance on this would be greatly appreciated...
Thank you in advance.


$sql = "INSERT INTO new_plantel_instructores (id_instituto, id_persona,fecha_insercion) values ($id_instituto, ".$values['id_persona'].",'".$fecha_actual."')";

CustomQuery($sql);
$sql="UPDATE anexo_1 SET id_anexo_1_1=".$values['id_anexo_1']." WHERE id_anexo_1=".$values['id_anexo_1']."";

CustomQuery($sql);

Admin 3/23/2020

In regards to updating multiple tables check this:

https://xlinesoft.com/phprunner/docs/update_multiple_tables.htm