I can insert hardcoded values into an SQLite table with no problem, but I\'m trying to do something like this:
name = input(\"Name: \")
phone = input(\"Phone
cur.execute("create table contacts (name, phone, email)")
cur.execute("insert into contacts (name, phone, email) values(?,?,?)",(name, phone, email))
OR
cur.execute("insert into contacts values(?,?,?)",(name, phone, email))
As you are inserting values to all available fields, its okay not to mention columns name in insert query
cur.executemany("insert into contacts (name, phone, email) values (?, ?, ?)", (name, phone, email))
You can use ?
to represent a parameter in an SQL query:
cur.execute("insert into contacts (name, phone, email) values (?, ?, ?)",
(name, phone, email))