I tried to update (add) the integer value of a cell named "product_qty" in a table in an SQLite database with a variable, with the following lines of code
x = int(TOPUPQTY.get())
cursor.execute("UPDATE 'product' SET product_qty = product_qty + x WHERE `product_name` LIKE ?", ('%'+str(TOPUPPRODUCT_NAME.get())+'%',))
I got an sqlite3.OperationalError: no such column: x.
But when I tried substituting the variable x with a constant say 30, that is:
cursor.execute("UPDATE 'product' SET product_qty = product_qty + 30 WHERE `product_name` LIKE ?", ('%'+str(TOPUPPRODUCT_NAME.get())+'%',))
this worked very well, but i need to use a variable instead of a constant.