Please I am having some problem with my json file and I am hoping someone can help me. I have searched but can not fully understand the solution i found.
I have checked here json with special characters like é with no luck and some other places too.
Here is my json array script
<?php
$response = array();
require_once __DIR__ . '/db_connect.inc.php';
$result = mysql_query("SELECT id, name, artist_id, year, length, ndisc, keywords, hits, image, review, user_id, tags, genre_id, added, album_file FROM albums ORDER BY id DESC") or die(mysql_error());
if (mysql_num_rows($result) > 0) {
$response["albums"] = array();
while ($row = mysql_fetch_array($result)) {
$album = array();
$album["id"] = $row["id"];
$album["name"] = $row["name"];
$album["artist_id"] = $row["artist_id"];
$album["year"] = $row["year"];
$album["length"] = $row["length"];
$album["ndisc"] = $row["ndisc"];
$album["keywords"] = $row["keywords"];
$album["hits"] = $row["hits"];
$album["image"] = $row["image"];
$album["review"] = $row["review"];
$album["user_id"] = $row["user_id"];
$album["tags"] = $row["tags"];
$album["genre_id"] = $row["genre_id"];
$album["added"] = $row["added"];
$album["album_file"] = $row["album_file"];
array_push($response["albums"], $album);
}
$response["success"] = 1;
echo json_encode($response);
} else {
$response["success"] = 0;
$response["message"] = "No album found";
echo json_encode($response);
}
?>
This works fine when there is no special character text in the array. So the problem I am having with this is that it doesn't return anything when special character text such as é, ö, Ø etc is in any of the array field.
So what I want to know is please how can i rewrite this my json script to retrieve those value?
Thank you very much in advance.