0

My Code is :

find = "https://example.com"
sqlite_select_query = "SELECT * FROM 'table' where links LIKE (?)"
c.execute(sqlite_select_query, (find,))

what is the problem? i want when i Select something, Code filter the result for me, when i run this code it returns [] and when im trying to add % at the first and the end like :

"SELECT * FROM 'table' where links LIKE (%?%)"

it gives me an operational error, what should i do to solve this problem?

1 Answers1

0

You must use the concatenation operator || like this:

find = "https://example.com"
sqlite_select_query = "SELECT * FROM 'table' where links LIKE '%'|| ? || '%'"
c.execute(sqlite_select_query, (find,))
forpas
  • 160,666
  • 10
  • 38
  • 76