<?php //controller
function notif()
{
$condition = $this->business_model->get_condition();
$this->data['query'] = $this->business_model->data_pagination_admin($condition);
$this->load->view('student_result',$this->data);
}
?>
<?php //model
function get_condition()
{
$this->db->select('condition');
$this->db->from('staff');
$query = $this->db->get();
return $query->result_array();
}
function data_pagination_admin($condition)//notif function
{
//...........
$this->db->where('flag','n');
//$user_id = $this->session->userdata('condition');
$this->db->where($condition,$user);//notice parameter condition
$this->db->order_by('next_date','asc');
$query = $this->db->get('student',10,0);
return $query->result_array();
}
/*im getting error :"Unknown column '0' in 'where clause'
SELECT * FROM (`student`) JOIN `status_table` ON `student`.`stud_id` =
`status_table`.`stud_id` WHERE `status_table`.`next_date` > '2013-06-09 23:59:59'
AND `flag` = 'n' AND **`0` = Array ORDER** BY `next_date` asc LIMIT 10"*/
?>
1.モデルからコントローラーに値を取得し、それをコントローラーに別の関数に渡しますが、エラーが発生します。
2.controller->get_condition->controller->data_pagination_admin()
3. get condition 関数は文字列を返します。