I have a program that updates multiple files. Basically it is an inventory update that updates the quantity and number sold based on the number sold in another file.
The update works fine unless the same item is sold in two sequential sales, in which case it does not use the updated qty on the second sale.
So as it steps through the while loop it is supposed to select the qty(A) from inventory and the qty from the sale line item where the inventory item number and the sale inventory item number are the same.
Then it calculates the new inventory qty by subtracting the sale qty.
Next it updates inventory changing the qty to the calculated qty and marking the sale as updated.(😎
Now next iteration through the while statement. If the same inventory item is sold it uses the qty (A) above rather than the updated qty which was supposed to have been saved in (😎 If the item numbers are different it works properly.
I thought maybe some variables were carrying over so I initialized them before calculating in each iteration. But the value coming in in the $row is not updating.
Why? And How do I prevent it?