This topic is locked

Before Record Added Question

12/19/2007 4:41:08 AM
PHPRunner General questions
G
Greeham author

I have 2 tables:-
tablea(id, name,tamount)

tableb(id, name, amount)
I would like to when a new record is added in 'tableb', append the 'tamount' value to add the 'amount' value to give new total.
So each time a new record is added would like 'amount' added to 'tamount' to give current value.
Obviously, the 'name' value would be the join.
Thanks,
Graham

J
Jane 12/19/2007

Graham,
use Before record added event for this purpose.

Here is a sample:

global $conn;

$updateSQL = "update tablea set tamout=tamout+".$values["amout"]." where name='".$values["name"]."'";

db_exec($updateSQL,$conn);

G
Greeham author 12/19/2007

Hi Jane,
Thanks for the help. It work's great.
Regards,
Graham