When I try to update the users portfolio I receive a runtime error from passing in 'when' as
date('now'). Please can someone tell what I should be doing. Here is part of my buy function code.
# calculate total price total = quote["price"]*amount cash = db.execute("SELECT cash FROM users WHERE id = :id", id = session["user_id"])["cash"] # check if user has sufficient cash and update portfolio if(cash >= total): db.execute("INSERT INTO portfolio (id, price, number, symbol, when) VALUES (:id, :price, :number, :symbol, date('now'))", id = session["user_id"], price = quote["price"], number = amount, symbol = quote["symbol"]) db.execute("UPDATE users SETS cash = cash - :price WHERE id = :id", price = amount, id = session["user_id"]) else: return apology("insufficient cash for chosen stock") # Redirect user to home page return redirect("/")