1
你好,我需要幫助我想從一個codeigniter的控制器傳遞三個不同的變量模型,所以我創建了一個數組,然後傳遞它然後我爆炸,我得到錯誤explode ()預計參數2爲字符串,數組給定發送陣列從控制器到模型codeigniter
控制器
$data = array(
'district_id' => $this->input->post('district') ,
'limit' => $limit,
'offset' => $offset,
);
$data['tubadili'] = $this->wapi_db->search_bar($data);
模型函數
public function search_bar($data){
$dataArray = explode(',' , $data);
$district_id = $dataArray[0];
$limit = $dataArray[1];
$offset = $dataArray[2];
$this->db->select('entertainment.Name,entertainment.ID,entertainment.Category,entertainment.Location,entertainment.Description,
image.ImagePath,image.Enter_ID,entertainment.DistrictID');
$this->db->from('entertainment');
$this->db->join('image', 'image.Enter_ID=entertainment.ID');
$this->db->where('entertainment.Category',"Bar");
$this->db->where('entertainment.DistrictID', $district_id);
$this->db->limit($limit, $offset);
$query = $this->db->get();
return $query->result();
}
你好,非常感謝你正在工作Perfectly Gracies @Aziz – user3551487