Hello I was following Python MYSQL update statement and managed to produce this code for my programme's SQL Update with variables function:
def editInfo(start, userName):
newFavGenre = input("Enter your favourite genre")
newFavArtist = input("Enter your favourite artist")
## userName is a global variable
con = lite.connect(db)
cur = con.cursor()
cur.execute ("""
UPDATE users
SET favGenre=%s, favArtist=%s
WHERE username=%s
""", (newFavGenre, newFavArtist, userName))
results = cur.fetchall()
return result
mainmenu()
And keep expericiencing this error code:
sqlite3.OperationalError: near "%": syntax error
Any ideas where I am going wrong?