0
cur.execute("Create table emails(email text, name text, count integer);")
 
cur.execute('''insert into table emails(email, name, count) values(?,?,0)''',(email,name,))

this gives me this traceback

Traceback (most recent call last): File "c:\Users\ibrah\OneDrive\Desktop\python course\my code\database.py", line 20, in cur.execute('''insert into table emails(email, name, count) values(?,?,0)''',(email,name,)) sqlite3.OperationalError: near "table": syntax error

I don't know why it is wrong

1
  • the command is INSERT INTO emails (...) VALUES (...) so get rid of the word table Commented Feb 7, 2024 at 12:40

1 Answer 1

0
INSERT INTO table (column1,column2 ,..)
VALUES( value1, value2 ,...);

You should replace "table" with the name of the table you want the items to be stored in.

To this:

INSERT INTO emails(email, name, count) VALUES(?,?,0)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.