Skip to content

Commit

Permalink
Merge pull request #4 from hrudu-dev/patch-1
Browse files Browse the repository at this point in the history
Update routes.py
  • Loading branch information
hrudu-dev authored Jan 14, 2025
2 parents 6fd054e + 06949bd commit 67d8e92
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ def index():

if name:
cursor.execute(
"SELECT * FROM books WHERE name LIKE %s", name )
"SELECT * FROM books WHERE name LIKE %s", ('%' + name + '%',)
)
books = [Book(*row) for row in cursor]

elif author:
cursor.execute(
"SELECT * FROM books WHERE author LIKE '%" + author + "%'"
"SELECT * FROM books WHERE author LIKE %s", ('%' + author + '%',)
)
books = [Book(*row) for row in cursor]

Expand Down

0 comments on commit 67d8e92

Please sign in to comment.