0

I have a problem with my code on buy. I was wondering if anyone can help me identify the error. Whenever I go to the buy and enter the symbol and shares and click buy, it shows a 500 Internal Server Error. Also, am I accessing the value of cash correctly? Here is my code.

enter image description here

The terminal shows this.

enter image description here

I was thinking the error is on this line and I replaced the first question mark with a name and removed the variable user_id. Still the same thing. Please help me. Thank you in advance

db.execute("INSERT INTO ? (symbol, name, shares, price, amount) VALUES(?, ?, ?, ?, ?);",user_id, symbol, name, shares, price, amount)
1

As per the sqlite doc, there are 3 forms of an INSERT stament. The first is

INSERT INTO table VALUES(...);

This INSERT INTO ? is incorrect. Neither table names nor column names can be parametrized in sqlite. The ? in that statement needs to be changed to a table name.

You must log in to answer this question.

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