which keywords found from search
not sure how to put it, but let say that I enter a phrase of 4 key words (eg: apple orange banana pine)to search on a column 'text' of a table:
let say the result yields 10 rows in which any row can have text contain either one of the fruits, a few, or all. My question is, how do we return which row contains which keyword when the result is returned? In most searching function, we return the "text" with the keyword highlighted. I want to do the opposite, I need to display the 4 keywords, and underline anyone of them which "text" contains.
$query = "SELECT text FROM books WHERE text ='apple' OR text='orange' OR text='banana' OR text='pine'";
If we search 1 key word at a time, that can do, but in this case, i have have than 1 phrase to begin with; thus search 1 keyword at a time sounds not a good idea, but not sure if there is any better alternative.