I want to display the name from the database but the name contains "Ñ" and it results "Null"
I'm using this code
$result = array();
$sth = $dbcon->prepare("MY SELECT CODE HERE");
$sth->execute();
while($row_count = $sth->fetch(PDO::FETCH_ASSOC)){
$result[] = $row_count;
}
echo json_encode($result);
And here is the result.. as you can see the null in name because of the "Ñ" cuz this string has and Ñ in the table
[{"emp_id":"12561-2013","name":null,"
Use json_encode with JSON_UNESCAPED_UNICODE flag, ie., json_encode($result, JSON_UNESCAPED_UNICODE);