I made next Query to update a row in my DB.
def saveData(title, LL, LR, RL, RR, distanceBack):
c.execute("UPDATE settings SET (?,?,?,?,?,?) WHERE name=?",(title, LL, LR, RL, RR, distanceBack, title))
conn.commit()
I always get next error: sqlite3.OperationalError: near "(": syntax error I know something isn't correct with the question marks. I can't find out what the exact solution is. Can somebody explain me what the problem is?
c.execute("UPDATE settings SET ({},{},{},{},{},{}) WHERE name={}".format(title, LL, LR, RL, RR, distanceBack, title)). When using string formatting to form queries that are executed by a DB you have to be careful of the injections you are allowing. If this will be used by other people too, you have to do some reading..UPDATEsyntax is wrong - w3schools.com/sql/sql_update.asp