I have a form input field 'text' and I want to create different query depending on value put in that field by a user
if the there is just a phrase - search each word (f.e. 'Hello World'):
SELECT (...) WHERE x LIKE '%Hello%' AND x LIKE '%World%' etc...
if the phrase is in quotation marks - search whole phrase (f.e. '"Hello World"'):
SELECT (...) WHERE x LIKE '%Hello World%'
And that's cool - I can do that.
But my problem starts when I have to mix above functionality - so f.e. if the phrase is 'Hello World "my name is" John' - it should search like this:
SELECT (...)
WHERE x LIKE '%Hello%'
AND x LIKE '%World%'
AND x LIKE '%my name is%'
AND x LIKE '%John%'
How would You implement such functionality and manage to do that in php?