查询没有通过mysq运行

2024-06-16 13:21:47 发布

您现在位置:Python中文网/ 问答频道 /正文

虽然存储在变量中的数据没有将值传递给select查询,但我无法从select查询中检索数据

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"

Tags: 数据fromimportformrequestmysqlusernameaccount
1条回答
网友
1楼 · 发布于 2024-06-16 13:21:47

fetchone()不返回int.Replace

if(account == 1):

if account is not None:

或者,更像Python

if account:

相关问题 更多 >