X
X
xxxfdd2020-12-06 18:36:39
Python
xxxfdd, 2020-12-06 18:36:39

Why does it give me no such column, although it exists?

I want to display a product where there is a user id next to it, here is the code, but I get an error: there is no such column

back_result = cur.execute(f"""SELECT * FROM {order} WHERE user_id = {user_id_q_bay}""").fetchall()

back_result = cur.execute(f"""SELECT * FROM {order} WHERE user_id = {user_id_q_bay}""").fetchall()
sqlite3.OperationalError: no such column: a535821263

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
galaxy, 2020-12-06
@xxxfdd

user_id = '{user_id_q_bay}'

S
Sergey Gornostaev, 2020-12-06
@sergey-gornostaev

Because using string interpolation to form a query is a very bad practice.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question