My data in DB are utf-8 encoded what appeared to be a problem for json_encode function in my PHP file (list.php). When I added an option JSON_UNESCAPED_UNICODE to the function everything started to work just fine.

Thank you for your intention to help me!

This is my list.php file:

$sql = "SELECT * FROM students";
//echo $sql;
$stmt = $conn->query($sql);

$cr=0;
$students = Array();
while($row = $stmt->fetch()) {
//    echo $row['sid'];
    $students[$cr]['sid'] = $row['sid'];
    $students[$cr]['fName'] = $row['fName'];
    $students[$cr]['lName'] = $row['lName'];
    $students[$cr]['email'] = $row['email'];
    $cr++;
}

echo json_encode($students, JSON_UNESCAPED_UNICODE);

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top