php collects input data using POST method. He is connected right, he is searching, but when typing the UF and Municipality he does not only show me exactly what I typed, but also the related ! I did not know what to do, but I did not know what to do. anyway, show everyone of them, or ã and I want to show ONLY EXACTLY WHAT I DIGIED. If anyone knows and can help, I am very grateful. Here is my link:
<?php
include ('conectar.php');
$connection = mysqli_connect($host, $user, $pass,$database);
if (!$connection) { echo ("Erro ao conectar"); }
$opcao = $_POST["opcao"];
if($opcao == "2"){
$sg_uf = '"%'. $_POST["txtsg_uf"] .'%"';
$nm_municipio = '"%'. $_POST["txtnm_municipio"] .'%"';
$nm_candidato = '"%'. $_POST["txtnm_candidato"] .'%"';
$dt_ano = '"%'. $_POST["txtdt_ano"] .'%"';
$query = "SELECT * FROM resultado "
. "WHERE sg_uf LIKE ".$sg_uf." OR nm_municipio LIKE ".$nm_municipio." OR nm_candidato LIKE ".$nm_candidato." OR dt_ano LIKE ".$dt_ano."";
$result = mysqli_query($connection,$query);
if (!$result) {
die("Query inválida na seleção dos dados");
}
while ($dados= mysqli_fetch_array($result,MYSQLI_ASSOC)) {
if ($result > 0){
echo "Opção de Busca Avançada/Eleições Municipais: <br />";
echo "Encontramos!<br/ >";
echo "UF do Estado: $dados[sg_uf]<br />";
echo "Nome do Município: $dados[nm_municipio]<br />";
echo "Nome do Candidato: $dados[nm_candidato]<br />";
echo "Ano da Eleição: $dados[dt_ano]<br />";
echo "<hr>";
}
else {
echo "Desculpe, nada foi encontrado.";
}
}
}
?>