0

My error is above. This is weird because it does exist. http://imgur.com/a/kGXsX That is my portfolio table. This is my command:

purchase = db.execute("INSERT INTO portfolio (shares, stock, price) VALUES          (shares, symbol, balance)")

Thanks, Ian

2
  • Hmmm, Are you connected to the correct database?
    – Cliff B
    Mar 28 '17 at 21:21
  • Yes. I reran phpliteadmin and got the link and it is there.
    – Ianardo
    Mar 28 '17 at 21:27
0

You need to use bound variables in the VALUES clause, else it takes them as string literals. Like

purchase = db.execute("INSERT INTO portfolio (shares, stock, price) VALUES (:shares, :symbol, :balance), shares=shares, symbol=symbol, balance=balance")

5
  • Just like that?
    – Ianardo
    Mar 28 '17 at 22:51
  • edited answer. I can't guarantee it's perfect, it hasn't been run in the app. Mar 28 '17 at 23:04
  • Hmmm.. It gives me this: RuntimeError: Bind parameter 'shares' without a renderable value not allowed here.
    – Ianardo
    Mar 28 '17 at 23:07
  • so is there a variable "shares" in your program? Mar 28 '17 at 23:25
  • there is. the thing is, it doesn't find anything
    – Ianardo
    Mar 29 '17 at 1:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .