passing value from master table to details table

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
amsire2
User
Posts: 130

passing value from master table to details table

Post 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)


arbei
User
Posts: 9292

Post 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

amsire2
User
Posts: 130

Post by amsire2 »

May I know where should I place this coding?


arbei
User
Posts: 9292

Post by arbei »

You may use in server events in which you want to get your value.


Post Reply