0
Colleagues.
I want to bring results from a mysql table, but it’s not working. What is causing me strangeness is that when the information has accents, it does not work, and in the database the accents are correct. See:
include("includes/conexao.php"); // Faço a conexão
$escola = htmlentities(filter_input(INPUT_POST,"BuscarEscola"));
$escolaSeguro = mysqli_real_escape_string($con,$escola);
$sqlEscolas = mysqli_query($con,"SELECT * FROM escolas WHERE nome = 'Colégio Inclusão';");
$jmEscolas = mysqli_fetch_object($sqlEscolas);
echo "Nome " .$jmEscolas->nome;
What is the
engine
from your database ?– Mauro Alexandre
In short, you have to make sure that all the encodings of your stuff are in the same pattern starting with the code editor. More details in the answers to the linked question above.
– Bacco
In the case of accent the bd charset has to be Unicode tb. But why are you using the operator = in a name search? It would not be more logical to use like '%College Inclusion%'?
– Norivan Oliveira
@Norivanoliveira if he wants an exact search, the
LIKE
doesn’t make sense. In fact, what I see of people usingLIKE
where no need here on the site is absurd. Besides being terrible, becauseLIKE
with joker at the beginning does not avail index.– Bacco