I am trying to use a input
variable into a SELECT
statement but getting the error below.
Here is my code:
sheetname=input("Enter the name of the SEO Analysis sheet:")
cur=conn.execute("select * from seo_info where url like '%?%'",sheetname,)
print(cur.fetchall())
and here is an error:
File "E:/Python/SEO_Project2.py", line 40, in <module>
cur=conn.execute("select * from seo_info where url like '%?%'",sheetname,)
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 0, and there are 9 supplied.
Here is another question, that addresses a part of the issue, but still it is giving me error.
Maybe I am missing a little something in my code?
2
Answers
I did it !
You don’t really need parentheses around
?
, so you can achieve what you want usinglist
, as a second argument toexecute
:or
tuple
: