尽管存储在变量中,但没有将值传递给选择查询,我却无法从选择查询中检索数据
from flaskext.mysql import MySQL
@app.route("/loginscr/",methods =['POST'])
def loginscr():
username = request.form['username']
password = request.form['password']
print(request.form.to_dict())
cursor = connection.cursor()
cursor.execute('Select * from basics where username = %s AND password = %s',(username,password))
account = cursor.fetchone()
if account is not None:
print("Successfull")
else:
print("UnSuccessfull")
return "true"
答案 0 :(得分:0)
fetchone()
不返回整数。替换
if(account == 1):
使用
if account is not None:
或者,更像Python一样,
if account: