This topic is locked

Error inserting total from child to master table

6/25/2012 10:51:46 AM
PHPRunner General questions
C
cristi author

I have two tables than are in a master child relationship:
Master table is Projects and child table is Expenses.
In Expenses I have a field Expense that has a totals total field.
I want this total field to be inserted and updated automatically in a field in the master table like this:


I found HERE a topic describing how to do this but I receive the following error:


I inserted in the events tab, child table->Add page->after record added:

global $strTableName,$dal;

$rs = CustomQuery("select sum(Expense) from Expenses where Project=".$_SESSION[$strTableName."_masterkey1"]);

$data = db_fetch_numarray($rs);
$dal->Projects->Value["Totalexp"] = $data[0];

$dal->Projects->Param["Project"] = $_SESSION[$strTableName."_masterkey1"];

$dal->Projects->Update();
Sergey Kornilov admin 6/25/2012

Post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.