Reputation: 903
when I run it I get: sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 0, and there are 4 supplied.
import sqlite3
database=sqlite3.connect("users.db")
cursor=database.cursor()
data=("first","last","email","True")
print(data)
cursor.execute("INSERT INTO users_db VALUES('%s','%s','%s','%s')",data)
data=cursor.execute("SELECT * FROM users")
print(data.fetchall())
Upvotes: 1
Views: 776
Reputation: 312136
Single quotes ('
) denote string literals. Here, you're inserting four values of the string literal %s
. If these are supposed to be placeholders from bind variables, you should remove the quotes:
cursor.execute("INSERT INTO users_db VALUES(%s, %s, %s, %s)", data)
Upvotes: 1