Search phrase in the database

0

Hello

I'm getting a parameter via GET which is a phrase (The Mouse Rooted in the Clothes of the King of Rome) and wish by means of a SELECT using the < strong> WHERE search this phrase in the database, respecting the spacing between words. How can I do it?

Thank you

    
asked by anonymous 05.09.2017 / 23:25

1 answer

1

If it's MySQL, you can use LOCATE or LIKE:

"Select * from tabela where LOCATE('". $_GET["frase"] ."', campo) > 0"

"Select * from tabela where campo LIKE '%". $_GET["frase"] ."%'"
    
05.09.2017 / 23:58