So I have a table in my Customers.db file that looks like this:
I wanted to make a function which returns the "rows" which has the id equal to the user input. The Table is also called 'Customers and all the columns are type TEXT.
def run_query(db, query, args=NONE):
con = sqlite3.connect(db)
cur = con.cursor()
if args is None:
cur.execute(query)
else:
cur.execute(query, args)
data = cur.fetchall()
cur.close()
con.close()
return data
def get_info_by_id(db, ide):
query = "SELECT * FROM Customers WHERE id = ?"
return run_query(db, query, ide)
When I ran this in the shell like this
get_info_by_id('Customers.db', '920')
I get the error "sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 3 supplied."