0

I have a problem with my Display datas from Mysql php page. My problem is when I want to display some hungarian specific chars like "á" or "é" they replaced with question marks. I set all of my tables and rows to utf8_hungarian_ci, and the entire table and rows to utf8_unicode_ci, but it doesn't work. A tried in my php code to set this "header(Content-Type: text/html; charset=utf-8)" at the beginning of my php code, but i haven't got any success with that. Can anybody help me? Thank you! Edit: The code that I trying to use:

<?php
header('Content-Type: text/html; charset=utf-8');
function testfun()
{


$con=mysqli_connect('blabla");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$result = mysqli_query($con,"SELECT * FROM adatok");

echo "<table border='1'>";

$i = 0;
while($row = $result->fetch_assoc())
{
    if ($i == 0) {
      $i++;
      echo "<tr>";
      foreach ($row as $key => $value) {
        echo "<th>" . $key . "</th>";
      }
      echo "</tr>";
    }
    echo "<tr>";
    foreach ($row as $value) {
      echo "<td>" . $value . "</td>";
    }
    echo "</tr>";
}
echo "</table>";

mysqli_close($con);


}
   testfun();

?>
FREWW
  • 33
  • 4

1 Answers1

-1

inside php tags use it this way $stringTest = htmlentities("ésé"); Then inside html tags use the variable

or simply use header('Content-Type: text/html; charset=ISO-8859-1');

user3808887
  • 319
  • 2
  • 9