How to solve a search problem with accented words

0

I made a data entry into a table in my database using the command load and the fields with accent were correct, such as Sofá Nápoli , but when changing any record that contains accent through my control panel the record sent to the bank is thus Sofá Nápoli , my table is coded as utf8_general_ci . When I search my site for the term Sofá Nápoli the record is not displayed. The redemption of my variable when it is typed into the search field looks like this:

$_SESSION['s'] = addslashes($_REQUEST['s']);
$pesquisa = $_SESSION['s'];
$pesquisa = (strtolower($pesquisa));

I could not find a solution that worked right

    
asked by anonymous 07.04.2015 / 18:02

2 answers

2

Use the html_entity_decode () function before passing the query name to the database. The call will look something like this:

$string = html_entity_decode($string, ENT_QUOTES, "utf-8");
    
07.04.2015 / 18:18
0

At the time you are going to make the query at the bank, turn the two in the upper / lower case.

Example:

Select * from where LOWER(campo) like LOWER($pesquisa)
    
07.04.2015 / 21:08