阅读背景:

从模型到控制器并返回到模型的数据

来源:互联网 
<?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"*/


?>
<?php //controller
function notif()
{
    $cond



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: