Adding varible in SQL command not working with Select statment HELP please

问题描述 投票:0回答:0
x = int(id_[0])
select_query = "SELECT * FROM files WHERE id = %s"
cursor.execute(select_query,x)
results = cursor.fetchone()

我在 python 中使用 mySQL

当我摆脱变量并添加一个像 1 这样的随机 id 时,它就起作用了。

python mysql sqlcommand
© www.soinside.com 2019 - 2024. All rights reserved.