Answer the question
In order to leave comments, you need to log in
How to insert a variable into a PyMySQL string?
I insert data into the table like this:
cur.execute("INSERT INTO users_data (`user_id`, `name`) VALUES (%s, 'Канал %s');", (member.id, member.display_name,))
'Канал User_name'
, but 'Канал 'User_name''
. It throws an errorpymysql.err.ProgrammingError: (1064, "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 'User_name'')' at line 1")
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question