I
I
Ivan_sneg2021-02-16 23:35:38
Python
Ivan_sneg, 2021-02-16 23:35:38

Error while working with Sqlite. Help me fix it?

The error is out of the blue. I don’t know how to fix it, help me.
def reg(self):
login = self.root.a_in_class.text
email = self.root.b_in_class.text
password1 = self.root.c_in_class.text
password2 = self.root.d_in_class.text
conn = sqlite3.connect("users .db")
cur = conn.cursor()
list = [login,email,password1]
if password2 == password1:
for item in list:
print(item)
cur.execute("INSERT INTO data VALUES(?,?,? )", (item, ))
conn.commit()

Here is the error:
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 3, and there are 1 supplied.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
galaxy, 2021-02-16
@Ivan_sneg

What are the fields in the data table?
Most likely, this code should be:

if password2 == password1:
    cur.execute("INSERT INTO data VALUES(?,?,?)", (login,email,password1))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question