Code in .py file:
cur = mysql.connection.cursor()
# Check if this user had voted for somebody
is_voted = cur.execute("SELECT TUTOR_VOTED FROM USERS WHERE USERNAME="+str(session["username"]))
session["username"] keep a user cookie. The user I already logged in names "admin"
But there might be something wrong with the MySQL command inside is_voted
Error:
MySQLdb._exceptions.OperationalError: (1054, "Unknown column 'admin' in 'where clause'")
But I got the correct return value while using
SELECT TUTOR_VOTED FROM USERS WHERE USERNAME='admin'
Is there anything wrong with my input format inside is_voted?

is_voted=cur.execute("SELECT TUTOR_VOTED FROM USERS WHERE USERNAME= ?",(session["username"])), can you try this and let me know the resultMySQLdb._exceptions.ProgrammingError: not all arguments converted during bytes formattingis_voted=cur.execute("SELECT TUTOR_VOTED FROM USERS WHERE USERNAME= ?",str((session["username"])))is_voted = cur.execute("SELECT TUTOR_VOTED FROM USERS WHERE USERNAME='%s'" % str(session["username"]))works