What causes this error in my code?
$query = $this->db->query(\"SELECT * FROM tour_foreign ORDER BY id desc\"); $data = array(); foreach ($q
json_decode() is used to decode a json string to an array/data object. json_encode() creates a json string from an array or data. You are using the wrong function my friend, try json_encode();