Try:

c.execute("SELECT pid FROM posts WHERE title LIKE ?", ('%'+keyWord+'%',))

In your case, you can also use instr which return the index of the substring you’re searching for (0 otherwise):

c.execute("SELECT pid FROM posts WHERE instr(title, ?) > 0", (keyWord,))

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top