I
I
Ilya T.2018-10-12 15:46:34
MySQL
Ilya T., 2018-10-12 15:46:34

What is wrong with my python mysql query?

I seem to somehow misunderstand the idea of ​​%s parameters, but it does not reach me why this construction does not work:

cursor.execute("select ID,LINK from LINKS where USERID=%s ",(id))

mistake:
(42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%s' at line 1

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2018-10-12
@Insaned

By the missing comma after id, you misunderstand the idea of ​​tuples.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question