PHP 5.5 Upgrade Broke this Simple Array / JSON Encoder -
I just upgraded from 5.3.x to 5.5.17 and the following code stopped working (I got a blank response ).
$ gestr = mysql_query ("Selection Name, Age, ID From Users"); $ String = array (); $ (Starid = mysql_fetch_array ($ gestr)) {$ star [] = array ('name' = & gt; $ starid ['name'], 'age' = & gt; $ starid ['age'], 'id '= & gt; $ starid [' id ']); } $ End = array ('user' = & gt; $ star); Echo json_encode (last $); Please note that I have simplified the SQL statement, but I know that it works all the way through the loop because I have $ star [1] [name] I can do echo and it prints usernames The issue json_encode was not able to parse a non-UTF8 encoded name.
Error in UTF 8_xode ();
$ star [] = was added by adding ('name' = & gt; utf8_encode ($ starid ['name']), 'era' => $ starid [' Age '],' id '= & gt; $ starid [' id ']);
Comments
Post a Comment