我不确定我在这里缺少什么,但这里是代码
public function searchFlightsList($filters, $rpp, $pn, $sort_by, $sort) {
$arr = array();
$this->db->select('flight.id,' .
'flight_no, airline.name as airline_name, des.name as destination_name,' .
'ori.name as origin_name, time', false);
$this->db->from($this->tbl_flight);
$this->db->join($this->tbl_airline , 'airline.id = flight.airline_id', 'left');
$this->db->join($this->tbl_location . ' as ori', 'ori.id = flight.origin_id', 'left');
$this->db->join($this->tbl_location . ' as des', 'des.id = flight.destination_id', 'left');
$this->db->order_by($sort_by, $sort);
$query = $this->db->get();
$arr = $query->result_array();
return $arr;
}
上面的功能正常但是这个:
public function searchPolicyList($filters, $rpp, $pn, $sort_by, $sort, $policy_no) {
$arr = array();
$this->db->select('policy.id,' .
'CONCAT_WS(" ", is_main_id.first_name, is_main_id.middle_name, is_main_id.last_name) as main_full_name,' .
'policy_no', false);
$this->db->from($this->tbl_policy);
$this->db->join($this->tbl_user. ' as is_other_id','is_other_id.id = policy.associated_id','left');
$this->db->join($this->tbl_user. ' as is_main_id','is_main_id.id = policy.main_id','left');
$this->db->order_by($sort_by, $sort);
$query = $this->db->get();
$arr = $query->result_array();
return $arr;
}
产生致命错误:在非对象上调用成员函数result_array()...
我检查了数据库表并且字段很好,但我只能使用associated_id和main_id字段加入用户
任何帮助都将受到高度赞赏