Skip to content
Advertisement

How do I update my stock database to reduce itself once a customer orders

Time to ask from the almighty stack overflow questions again. So my problem is that I am developing in TKINTER and have implemented and integrated 2 tables in one database on the application. I would like my table products to update once an order is placed on basket table and it happens once the self.data_entry method is called. The thing is when my stock_update method runs, it updates the database but it wipes the stock value of the other products. I’m just wondering if my stock_update method has the wrong syntax for updating sql.

BEFORE Running

product_id product_name stock
1 product1 60
1 product2 60

AFTER

product_id product_name stock
1 product1 59
1 product2 NULL

class DatabaseHandler:

Advertisement

Answer

I revised the query. Hope this work:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement