Page 1 of 1
passing value from master table to details table
Posted: Mon Aug 01, 2022 11:33 am
by amsire2
How to pass value from master table to details table.
For example I have 2 tables
Table1 (master)
Fields = ID, Totals
Table 2 (details)
Fields = ID, PaymentTotal
I want to pass the value form Table 1 (Totals) to PaymentTotal in Table 2. (v2022)
Re: passing value from master table to details table
Posted: Mon Aug 01, 2022 10:51 pm
by arbei
In the detail table you only know the foreign key, you may get a value of the master record by, e.g.
$myValue = ExecuteScalar("SELECT `MyField` from `MyMasterTable` WHERE ID = " . $this-><MyForeignKeyField>->CurrentValue); // You need to replace field/table name by your actual ones
Re: passing value from master table to details table
Posted: Sun Aug 07, 2022 3:33 pm
by amsire2
May I know where should I place this coding?
Re: passing value from master table to details table
Posted: Sun Aug 07, 2022 9:58 pm
by arbei
You may use in server events in which you want to get your value.