2

When I take out my "note" column in my SQL select it converts it to a json array but when I add it back in I get no echo at all - the note column can be up to 500 characters.

After my query I do this :

header('Content-Type: application/json');
var_dump($arrResult);
echo json_encode($arrResult); 

the json_encode($arrResult) is blank but the $arrResult is :

array(3) {
  [0]=>
  array(3) {
    ["ref"]=>
    string(5) "12291"
    ["user"]=>
    string(11) "H.a"
    ["note"]=>
    string(639) "Dear Mrs s

Further to your phone callblabal"
  }
  [1]=>
  array(3) {
    ["ref"]=>
    string(5) "11369"
    ["user"]=>
    string(10) "sss"
    ["note"]=>
    string(39) "VM left IP"
  }
  [2]=>
  array(3) {
    ["ref"]=>
    string(5) "12101"
    ["user"]=>
    string(6) "K.Holt"
    ["note"]=>
    string(159) "<div>Spoke with client</div>"
  }
}

Is there some kind of restriction?

Since it breaks on 3 I am thinking something to do with <div>?

4
  • 3
    Any change if echo json_encode($arrResult,true); ? Commented Apr 20, 2016 at 11:47
  • May be try the answer from stackoverflow.com/questions/20694317/… Commented Apr 20, 2016 at 11:48
  • Ask json_last_error() and check for proper encoding (UTF-8). Commented Apr 20, 2016 at 11:50
  • YOUR CODE WORKS FOR ME. :- eval.in/556939 Commented Apr 20, 2016 at 11:57

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.