title: SQL LIKE using variable from user as a search
body: <p>I'm trying to make a search functionality to output all available books based on author typed in a form (I'm using sqlite)</p>
  <p>I'd like to use LIKE function.</p>
  <p>The piece of code I'm using is as follows:</p>
  <pre><code># User reached route via POST (submitting the form)
  else:
      query = request.form.get(&quot;query&quot;)
  
  # Ensure symbol is not blank
  if not query:
      return apology(&quot;you haven't typed anything!&quot;, 400)
  
  # A list querying available books by a similar author
  books = db.execute(&quot;SELECT author, title, genre, id FROM books WHERE booked = 0 AND author LIKE '%' + :query + '%'&quot;,
                    query = query)
  </code></pre>
  <p>However, it doesn't seem to work.
  No errors are found, but when I try to print out books, it returns always empty, even if I type in the exact author name.</p>
  <p>How can I fix this?</p>
  <p>Thanks!</p>