I have a php script and a table in a database. The php script selects all the rows and takes them to an array. I have also an Android device which calls this script. Everything workks fine, but if there are some special characters(like "Ñ") in the database row, the script return a NULL value. How can I solve the problem? Here is the code:
$response = array();
require_once __DIR__ . '/db_connect.php';
$db = new DB_CONNECT();
$result = mysql_query("SELECT *FROM candi") or die(mysql_error());
if (mysql_num_rows($result) > 0) {
$response["candi"] = array();
while ($row = mysql_fetch_array($result)) {
$candi = array();
$candi["id"] = $row["id"];
$candi["name"] = $row["name"];
array_push($response["candi"], $candi);
}
$response["success"] = 1;