This topic is locked

Update data in master table

5/9/2010 9:50:28 PM
PHPRunner General questions
romaldus author

I have two tables as example :
MASTER TABLE

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

STOCK_ID...STOCK_NAME....STATUS

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

1..........PENCIL........AVAILABLE

2..........BOOK..........AVAILABLE

3..........RUBBER........AVAILABLE
CHILD TABLE

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

ORDER _ID.......STOCK_ID

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

10011...........1
I want when i insert a new record in the child table where STOCK_ID = STOCK_ID in master table..... record STATUS in master table changed from AVAILABLE to SOLD
In above Example, PENCIL status in master table should changed to SOLD
How I configure it in PHPRUNNER events?

A
ann 5/11/2010

Hi,
Use AfterAdd event on the Events tab of Child table. Here is the sample code:

$sql = "UPDATE master_table SET Status= 'sold' WHERE Stock_Id=" . $values["Stock_Id"];

CustomQuery($sql);