I have a simple search engine that looks up values in the DB and displays it on the page. In the table I have a column called keywords where the words I leave as a search parameter are registered. I need two things. The first is that when typing the word with capital or small letter it understands the same way without that I have to register both in the DB. The second thing is that he adds the words to the search. For example: I registered the words in the table in the following order; house roof construction. If I type house roof does not return anything to me, only if I search for one of the two. I want him to look for both.
Code
$busca = trim($_POST['busca']);
$sql = mysqli_query($conn, "SELECT * FROM pesquisa_clientes WHERE palavraschaves LIKE '%".$busca."%' ORDER BY nome");
$numRegistros = mysqli_num_rows($sql);
if ($numRegistros != 0) {
echo "<h4 class='result'>Resultados para: <b> " . $busca . "</b></h4><br />";
while ($usuario = mysqli_fetch_object($sql)) {
echo "<div id='resultados'>";
echo "<img src='images/clientes/".$usuario->logo."' alt='Foto de exibição' /><br />";
echo utf8_encode("<h4><b> " . $usuario->nome . "</b></h4><br />");
echo utf8_encode("<p><span><b> " . $usuario->subcategoria . "</b></span></p><br /><br />");
echo utf8_encode("<p><b>Bairro:</b> " . $usuario->bairro . "</p><br />");
echo "<p><b>Telefone:</b> " . $usuario->telefone . "</p><br />";
echo "<a href='". $usuario->link_cliente. "'><b>Saiba Mais</b></a><br /><br />";
echo "</div>";
}
} else {
echo "<h4 class='result'>Nada foi encontrado com a palavra:<b> ".$busca."</b></h4>";
}
?>