I want to get JSON but it is not working when there is a "Ñ". I have a change the collation of my database to utf8_general_ci. The total count of the data is 2292. When I use json_encode nothing appears but when I use echo the data appears. How can I fix this?
$sql = "SELECT FileAs FROM tblContacts WHERE Coordinator = '$ContactID'";
$result = mysqli_query($conn, $sql);
$count = mysqli_num_rows($result);
if($count > 0){
while ($row = mysqli_fetch_array($result)) {
$ar[] = array(
'FileAs' => $row['FileAs']
);
}
}
print json_encode($ar);