I have an Android app, PHP page and MySql db.
The android app send a string parameter to the server, I use Gson so I know that the Json string is correct.
On server side I store that string of json as Text
field.
On web client I take that field from my database and doing json_decode and receives a NULL
.
Most of the site written by PHPMAKER 10
so I use it's database connection.
$result="";
$rs->MoveFirst();
if ($rs) {
$result = $rs->fields[0];
}
$rs->Close();
$extras = json_decode($result, true);
I checked that json in Json validator and it looks fine.
Any ideas why I gets null? (maybe encoding)
EDIT: I did the following check:
echo "<script> var x = {$result}; console.log(x.length)</script>";
Chrome gave the following error:
Uncaught SyntaxError: Unexpected token ILLEGAL
EDIT 2:
If I print that string echo $result
and copy that to a variable it works.