What causes this error in my code?
$query = $this->db->query("SELECT * FROM tour_foreign ORDER BY id desc"); $data = array(); foreach ($query->result() as $row) $data[] = array('guide' => $row->guide); echo json_decode($data);
mistake:
erro: json_decode() expects parameter 1 to be string, array given: Line Number: 167
UPDATE:
If I use json_encode instead of json_decode , my output will be like this:
[{"guide":["\u0633\u06cc\u062f \u0633\u0639\u06cc\u062f \u062f\u0627\u062f\u0627\u0634\u0632\u0627\u062f\u0647"]},{"guide":["\u0633\u06cββc\u062f \u0633\u0639\u06cc\u062f \u062f\u0627\u062f\u0627\u0634\u0632\u0627\u062f\u0647"]},{"guide":null}]
These are Persian words.
json php
Jennifer anthony
source share