0
Good,
I have a file PHP with encoding UTF-8. And the text with accents in the part HTML they look like they should, but when I go to the database.
Database data viewed in the file php
include("connection.php");
<?php
include("connection.php");
echo "<div class='narrow-block wrapper'>
<h2>Inscrições (Federados)</h2>
<table id='table2'>
$result2 = mysqli_query($con,"SELECT * FROM registofederados");
while($row = mysqli_fetch_array($result2)){
echo "<tr>";
echo "<td>" . $row['dorsal'] . "</td>";
echo "<td>" . $row['nome'] . "</td>";
echo "<td>" . $row['bi'] . "</td>";
echo "<td>" . $row['dataNasc'] . "</td>";
echo "<td>" . $row['n_federado'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "<td>" . $row['telemovel'] . "</td>";
echo "<td>" . $row['morada'] . "</td>";
echo "<td>" . $row['local_dorsal'] . "</td>";
echo "<td>" . $row['pagamento'] . "</td>";
echo "<td>" . $row['equipa'] . "</td>";
echo "<td>" . $row['categoria'] . "km </td>";
if($row['almoco'] == 1)
echo "<td>Sim</td>";
else
echo "<td>Não</td>";
if($row['pago'] == 1)
echo "<td>Sim</td>";
else
echo "<td>Não</td>";
echo "</tr>";
}
</table>
</div>";
mysqli_close($con);
?>
If you use the Notepad++ and to avoid future problems go to the options menu, click on
Format
, and selects the encodingUTF-8(Sem BOM)
, you can set this by default in the settings, so as soon as you create a file it already comes inUTF-8(Sem BOM)
, if you already have a code written inANSI
you must click on Convert to UTF-8(No GOOD) it converts not being necessary corrections in the accents for example, as it already does it automatically. Remember UTF-8(NO GOOD) withoutBOM
.– Florida