This topic is locked

How to update master and details tables from Excel Import

10/21/2015 1:44:39 PM
PHPRunner General questions
A
Abul author

Does any one could explain how this help code below in the PHP manual works? I am interested to use this one for updating my Master (Country) and Detail (State) tables from Excel import function.
To update master and details tables use the following code for details table in Edit page: Before record updated events.

global $dal;

$tblDetail = $dal->Table("DetailTableName");

$tblDetail->Value["Field1"] = $values["Field1"];

$tblDetail->Param["OrderID"] = $values["OrderID"];

$tblDetail->Update();

unset($values["Field1"]);



Field1 is a field in the details table and OrderID is the linked field in the master table.
In my case State table has sid, state, country_id and Country table has id, country field. Appreciate your help. Thanks.

Sergey Kornilov admin 10/21/2015

The code in question updates details named "DetailTableName". You do not need any code to update master table since PHPRunner takes care of this automatically assuming this code is added to master table BeforeEdit event.
To find more about DAL's Update() function check this:

http://xlinesoft.com/phprunner/docs/update.htm