Search phrase in database

Asked

Viewed 87 times

0

Hello

I’m getting a parameter via GET which is a phrase ( The Rat Gnawed Upon the Clothes of the King of Rome ) and desire by means of a SELECT using the clause WHERE search this phrase in the database, respecting the spacing between words. How can I do ?

Thank you

  • 1

    It wouldn’t just be where frase = '$_GET[frase]', or similar? Or rather, edit the question and describe the structure of your bank, especially the column where you will perform the search.

  • What did you try?

1 answer

1


If you are Mysql, you can use LOCATE or LIKE:

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

"Select * from tabela where campo LIKE '%". $_GET["frase"] ."%'"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.