简体   繁体   中英

sqlite3.OperationalError: near “VALUES”: syntax error

username = input("Username: ")
password = input("Password: ")
authority = input("Authority level (1 or 2): ")
name = input("Name           : ")
surname = input("Surname        : ")
idnum = input("Identity Number: ")
c.execute("CREATE TABLE IF NOT EXISTS userInfo(username TEXT, password TEXT, authority TEXT, name TEXT, "
          "surname TEXT, idnum TEXT)")
c.execute("INSERT INTO userInfo VALUES(username, password, authority, name, surname, idnum) "
          "VALUES(?, ?, ?, ?, ?, ?)",
          (username, password, authority, name, surname, idnum))

conn.commit()

There seems nothing wrong but it returns:

sqlite3.OperationalError: near "VALUES": syntax error

and users.db remains empty

nope.. I get it..

c.execute("INSERT INTO userInfo (username, password, authority, name, surname, idnum) "

VALUES is making this error..

I hate this when I post my question here (I post here atleast after thinking 1 hour about it) I immedietly find the answer...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM