I created a search engine on my website where user can input whatever they like and show the result. Below is the code I use to get the result but it is not working because of the syntax error.
In my database I have 10 rows, each rows contain 4 columns(id, author, second_author, book_name). My goal is, if the user enter a name that is found in 'author', I want to retrieve that result, 'OR' if they enter a name that is found in book_name I want to retrieve that result and so on for the other columns..
I know the proper way to do this is by using LIKE Operator, but how about if you want to compare the keywords to several columns, what should you do?
I've tried this but was not working:
SELECT * FROM book_list WHERE author OR second_author OR book_name LIKE '%".$search_key."%'