<?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.im geting value from model to controller and passing it to controller to another function but getting error.

1.从模型到控制器的最小值,并将其传递给控制器​​到另一个函数但是出错。

2.controller->get_condition->controller->data_pagination_admin()

3.the get condition function will return just a string thats all

3. get条件函数将返回一个全部字符串

2 个解决方案

#1


0

get_conditioncurrently returns an array; try the code below:

get_conditioncurrently返回一个数组;试试下面的代码:

function get_condition()
{
$user = $this->session->userdata('user_id');
$this->db->select('condition');
$this->db->from('staff');
$this->db->where('user_id',$user );
$query = $this->db->get(); 
$result = $query->row_array();
return $result['condition'];
}

Edit: looks like your $user var in that where clause is also an array.

编辑:看起来像$ user var,其中where子句也是一个数组。

更多相关文章

  1. MySQL按数组值排序
  2. 向数组添加一组数据库列的问题
  3. 如何使用webrequest使用Json数组绘制折线图
  4. javascript判断数组和对象中是否存在某元素
  5. [JavaScript] 将字符串数组转化为整型数组
  6. 将JSON ID键插入到ng-click指令中,然后将其传递到另一个控制器
  7. 数组中的值由于未知原因而更改
  8. javascript 动态数组的使用
  9. 如何从控制器内的javascript函数调用角范围函数

随机推荐

  1. 如何在Android智能手机上捕获数据包
  2. android sdk 安装时无法连接到地址
  3. 《第一行代码(第二版)》学习(二)
  4. android中gravity和layoutgravity的区别
  5. Android入门之Activity的四种启动模式
  6. Android源代码编译脚本
  7. Android 常用控件(四)
  8. Android常用的网路框架
  9. android 数据持久化简述
  10. 【Android 初学】11、关于Android当中的