Invalid query: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 't ''Ever'' Give Up Poster' AND categories.category = 'Laminated Posters' AND boo' at line 1 Whole query: SELECT books.* FROM books, categories WHERE books.title = 'Don't ''Ever'' Give Up Poster' AND categories.category = 'Laminated Posters' AND books.category_id = categories.category_id