I want to save a mySQL-query in a json file with php. To get data from the query result I do
$resArray = array();
while($row = mysqli_fetch_assoc($result)) {
$resArray[] = $row;
}
echo json_encode($resArray);
Some fields may contain 'ä', 'ö' and 'ü'.
For example I have
"category":"Stöcke"
.
When json_encode the result array, fields with ä, ö and ü will be encoded as null, e.g. "category":null
How to correctly encode all resultsets to save the json correct and show all fields and contents?