In the buy
function, the walkthrough video talk about implementing the code below when trying to retrieve the cash.:
result = db.execute("SELECT cash from users WHERE id=1")
But obviously this gets the cash from id=1 all the time, so how would I get the cash from the user that is currently logged in?
I'd been trying to play around trying to solve this for an hour without success, thanks.
my attempt:
result = db.execute("SELECT cash from users WHERE id=:id", id= session['user_id'])
This apparently doesn't return an integer
, rather a list
data type.