I am trying to query the Database for a sub-string, I am substituting a string variable from a form for the query. It is giving me a syntax error.
This is the error:
LINE 1: SELECT * FROM books WHERE title LIKE '%'sometext'%'
This is the line:
books = db.execute("SELECT * FROM books WHERE title LIKE '%:form%'", {"form":form.search.data}).fetchall()
If I use an actual string in the SQL query it works. It is an issue with using a variable. Any assistance would be appreciated.