myCursor = mydb.connection.cursor() # used flask_mysqldb
for i in range(1, session['no_of_questions']+1):
myCursor.execute("UPDATE " + str.lower(str(quiz_code)) + " SET %s = " + str(selected_answers[i]) + " where question_code = %s ", (str(session['id'])+"A", str.upper(str(quiz_code))+str(i)))
myCursor.connection.commit()
myCursor.close()
#Error: 1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''9574A' = 2 where question_code = 'CNOP1'' at line 1"