I am trying to print a simple string in hebrew (UTF8) from mysql database. In the database the string is correctly, But when I print the string it's look like this - ×—× ×•×ª_חיות .
I would be happy if you can help me to understand why this is happened and how can I fix it. Thanks.
php -
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
mysqli_set_charset($conn,"utf8");
$sql = "SELECT * FROM Items WHERE id = '$token'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo "," . $row["title"];
}
} else {
echo "Not found row";
}
mysqli_close($conn);