【发布时间】:2015-03-26 03:28:19
【问题描述】:
您可能以前见过它,但我基本上是在尝试避免 MySQL 注入,所以我使用 Python 将查询格式化如下:
if "username" in form:
username = form["username"].value
else:
success = 0
error = "User Name is Missing"
cur.execute("SELECT COUNT(*) FROM users WHERE screenName=':1'",[username])
results = int(cur.fetchall()[0][0])
这会引发错误:
<type 'exceptions.TypeError'>: not all arguments converted during string formatting
args = ('not all arguments converted during string formatting',)
message = 'not all arguments converted during string formatting'
知道有什么问题吗? 谢谢
【问题讨论】: