I have a database of book titles.
I query the database based on a query string in a page's URL.
So for example, in the case there was a book called "Mike's Book", the query string would be 'mikes-book.' I perform some basic cleanup before passing the variable to the MYSQL query, turning 'mikes-book' into 'Mikes Book.'
The query fails, because the query string doesn't contain the apostrophe that matches the DB record.
Right now, I'm using this query:
"SELECT title FROM books WHERE title LIKE '$query_title'"
If no apostrophe is present in the DB record, the records are returned correctly. But when there is an apostrophe in the DB record, 0 results are returned.
Any ideas on what I can do here?