Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/346.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MYSQL连接器Python问题|选择查询_Python_Mysql - Fatal编程技术网

MYSQL连接器Python问题|选择查询

MYSQL连接器Python问题|选择查询,python,mysql,Python,Mysql,我在这个MySQL查询中遇到了一个问题,如何解决 valori = (message.from_user.id, message.from_user.username) verifica = "SELECT * FROM utenti WHERE ID = %s, Username = %s" cursor.execute(verifica, valori) 变量“valori”的样本: (1062473636,“Partizionare”) 错误: 1064 (4

我在这个MySQL查询中遇到了一个问题,如何解决

 valori = (message.from_user.id, message.from_user.username)
 verifica = "SELECT * FROM utenti WHERE ID = %s, Username = %s"
 cursor.execute(verifica, valori)

变量“valori”的样本:
(1062473636,“Partizionare”)

错误:

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

在条件中没有
,你的意思是

谢谢。我曾经在php中做过类似的查询。这在php中也不起作用。好吧,我只是有点困惑。我已经有一段时间没有使用数据库了。无论如何,谢谢你的帮助。