Reputation: 11
I'm having a problem with this MySQL Query, how can I fix that?
valori = (message.from_user.id, message.from_user.username)
verifica = "SELECT * FROM utenti WHERE ID = %s, Username = %s"
cursor.execute(verifica, valori)
A sample of variable "valori":
(1062473636, 'Partizionare')
Error:
1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' Username = 'Partizionare'' at line 1
Traceback (most recent call last):
File "/home/lello/.local/lib/python3.7/site-packages/pyrogram/dispatcher.py", line 217, in handler_worker
await handler.callback(self.client, *args)
File "/home/lello/Documents/Telegram/LelloDevBot/pyro.py", line 19, in start
cursor.execute(verifica, valori)
File "/home/lello/.local/lib/python3.7/site-packages/mysql/connector/cursor.py", line 551, in execute
self._handle_result(self._connection.cmd_query(stmt))
File "/home/lello/.local/lib/python3.7/site-packages/mysql/connector/connection.py", line 490, in cmd_query
result = self._handle_result(self._send_cmd(ServerCmd.QUERY, query))
File "/home/lello/.local/lib/python3.7/site-packages/mysql/connector/connection.py", line 395, in _handle_result
raise errors.get_exception(packet)
mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' Username = 'Partizionare'' at line 1
Upvotes: 0
Views: 56