This topic is locked
[SOLVED]

 How to get difference of two values

11/15/2010 2:16:12 AM
PHPRunner General questions
S
smith author

How to get difference of two values in same field and update another table

1 have two tables

Table1

Field_1 – Item_ID

Field_2 – On_hand_quantity
Table-2

Field_1 – Record_ID

Field_2 – Item_ID

Field_3 – Received

Whenever there is an entry in the table2 the quantity will be added to the table 1 Quantity field matching to Item_ID. This is fine when adding or deleting an entry from the table2 using evnts
for adding new quantity I use

$sql="update inv_product set On_hand_quantity=On_hand_quantity+".$values["Received"]." where Item_ID='".$values["Item_ID"]."'";

customQuery($sql);
in the “After record added event”
Now my question is when editing the table 2, I want to add the difference of the value put in the 'Received'

field (new value – Old Value) to the table 1 for updating

What is the script in which event to be used?

Regards

Smith
SOLVED THANK YOU <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=15736&image=1&table=forumtopics' class='bbc_emoticon' alt='B)' /> <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=15736&image=2&table=forumtopics' class='bbc_emoticon' alt='B)' /> <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=15736&image=3&table=forumtopics' class='bbc_emoticon' alt='B)' />