I\'m trying to get this Python MYSQL update statement correct(With Variables):
cursor.execute (\"UPDATE tblTableName SET Year=%s\" % Year \", Month=%s\" % Mo
Neither of them worked for me for some reason.
I figured it out that for some reason python doesn't read %s. So use (?) instead of %S in you SQL Code.
And finally this worked for me.
cursor.execute ("update tablename set columnName = (?) where ID = (?) ",("test4","4")) connect.commit()