0
Hello, I’m performing a get of files from the database to a page in order to be a search bar, but all results obtained are not accepting special characters, such as: ç, á, è.
ex: LEGISLATION O APLIC VEL
HTML/PHP:
<form action="search.php" method="POST">
<div class="input-group mb-3">
<input class="form-control" aria-label="Recipient's username" aria-describedby="basic-addon2" type="text" name="search" placeholder="Pesquisa...">
<div class="input-group-append">
<button class="btn btn-outline-secondary" type="button submit" name="submit-search">Buscar</button>
</div>
</div>
</form> <br>
<!-- Search bar -->
<?php
$sql = "SELECT * FROM tablename";
$result = mysqli_query($conexao, $sql);
$queryResults = mysqli_num_rows ($result);
if ($queryResults > 0) {
while ($row = mysqli_fetch_assoc($result)) {
echo "<div class='article-box'>
<h3>".$row['nome']."</h3>
<p>".$row['descricao']."</p>
<p>Relator: ".$row['relator']."</p>
<p>Data: ".$row['data']."</p>
</div>";
}
}
?>
Connection:
<?php
define('HOST', '127.0.0.1');
define('USUARIO', 'root');
define('SENHA', 'senha');
define('DB', 'dbname');
$conexao = mysqli_connect(HOST, USUARIO, SENHA, DB) or die ('Não foi possivel conectar!');
?>
Meta used in html:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
The collation of the database, connection and editor (Visual Studio Code) are:
utf8_general_ci
I tried to change the collation of everything to latin1_general_ci, but also failed.
The SET NAMES utf8 command did not result either.
At the head of html is in format <html lang="pt-BR">
I would like a light on this problem.
From now on, thank you for your patience!
@Pedroaugusto The solution of that other question did not result.
– Nithogg
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> try like this
– Sr. André Baill
@Mr Andrébaill There has been no change either
– Nithogg
could show me your connection with the bank ?
– Paulo Victor
@Paulovictor I may not have understood correctly, but is it the code that makes the connection to the bank? If so, I updated the question with the code.
– Nithogg
@Andersoncarloswoss The solution was to add the charset config on the bank connection described in the other question, thanks for the information.
– Nithogg