获取特定用户返回的值 'none'

Fetching the value of particular user returning 'none'

            email_entered = request.form['email']
            password_entered = request.form['password']
            # check the role of the user
            sql_role_query = """SELECT users.designation FROM users WHERE users.email = %s"""
            role = cursor.execute(sql_role_query, record_to_search)
            print("Executed role query")
            print(role)
            if(role == 'Admin'):
                return redirect(url_for('listuser'))
            else:
                return redirect(url_for('createuser'))
            connection.commit()

您必须在调用 execute 后获取结果。

尝试下一步:

cursor.execute(sql_role_query, record_to_search)
role = cursor.fetchone()