Example Script for Row_Updated in Help File (v10)

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

Example Script for Row_Updated in Help File (v10)

Post by zimmerlis »

Hi all

Be carefull the example script for Row_Updated has a typo: (v10, not v11)

This event will be called after updating a record. The arguments of the event are the arrays of the old and new record updated.

Example

After updating a field in detail table, update a field in the master table.

function Row_Updated($rsold, &$rsnew) {
//var_dump(rsold, rsnew); die(); // Print the old and new record and end the script
$rs = array();
$rs["FieldInMasterTable"] = $rsnew["FieldInDetailTable"]; // Set field values
(new cMasterTable())->Update($rs, "PrimaryKeyFieldInMasterTable = " + rsnew["ForeignKeyFieldInDetailTable"]); // Note: Table class is named as c<TableName>. Assume PrimaryKeyFieldInMasterTable is integer.
}

In the function the second time rsnew is without the & sign.

rehgards, René


mobhar
User
Posts: 11735

Post by mobhar »

Not the "&" sign, but the "$" sign.


zimmerlis
User
Posts: 9

Post by zimmerlis »

yes, sorry '$'


Post Reply