I am implementing the subtraction from the user's cash and I can't figure out a way to insert variables into my sql statement. The variables are numbers here.
Here is my code:
if user_cash > total_price: db.execute('UPDATE users SET cash = %d - %d WHERE id = 1', user_cash, total_price)
I get this error:
RuntimeError: 'int' object has no attribute 'key'
I tried using '?' instead of '%d', but the result is the same. What might cause it? Help me, please.