SQL IN HOOK
Posted: 2016-12-12 13:51
I am new to appgini but I am a programmer. I have a Billig_Header table and a Billing_Detail table. I want to update a 'Total' field in the header table as i add or update the Amount field in the Detail table. After doing some reading, I have done the following in the after_update and after_insert hooks of the Billing_Detail table but its not working.
sql("UPDATE Billing_Header SET Total=Total+{$data['Amount']} WHERE ID={$data['Billing_ID']}");
What am I doing wrong.
Thanks in advance.
sql("UPDATE Billing_Header SET Total=Total+{$data['Amount']} WHERE ID={$data['Billing_ID']}");
What am I doing wrong.
Thanks in advance.