I know this seems really basic, but whatever answers I can find simply don't work for me.
import sqlite3
conn = sqlite3.connect("mydb.db")
cursor = conn.cursor()
name = "John Doe"
cursor.execute("SELECT * FROM users WHERE username = ?", name)
items = cursor.fetchall()
print(items)
conn.close()
I'm trying to get a list of all users with the username 'John Doe' (which I know there is one of), but the previous code gives the following error:
Traceback (most recent call last):
File ".\sqlitetest.py", line 10, in <module>
cursor.execute("SELECT * FROM users WHERE username = ?", name)
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 8 supplied.