This topic is locked
[SOLVED]

 details table field sum= master table field

4/15/2017 11:06:22 AM
PHPRunner General questions
T
tubisan author

Hi All,

i'm new at PHPRunner, and i need help

i have 1 table Master and 1 table detail,

the table detail has a Alias Field Collum, thats calculate 1 field in current table detail,

and i want to sum value on total alias field in table detail, and the result is updated on table Master


case example :

==============

Master_Table

==============

id

alinan
==============

Detail_Table

==============

id

odeme
master table alinan field details table sum(odeme) ( alinan=sum(odeme)
I am very grateful if any one could help

T
tubisan author 4/16/2017



http://www.asprunner.com/forums/topic/12467-how-to-insert-total-from-detail-table-to-master-table-field/


master table

id

alinan
details table

id

odeme

rid
master - details relationship ( id - rid )

master table alinan details table odeme totals
-------

global $strTableName,$dal;

$rs = CustomQuery("select sum(odeme) from reklam_odeme where id=".$_SESSION[$strTableName."id"]);

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

$dal->MasterTableName->Param["id"] = $_SESSION[$strTableName."id"];

$dal->MasterTableName->Update();
------------
error code : 256

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1

select sum(odeme) from reklam_odeme where id=

T
tubisan author 4/16/2017