Hi, I'm trying to insert and update 2 tables, purchase and stock. The idea is when the user inserts from form the data is inserted into both tables, but when the user inserts an item that already exist in stock database it only updates the quantity so there's no duplicate and inserts it into purchase table (to be recorded as a purchase). The current code i wrote below is still give duplicate on stock table. I don't really understand the logic for...