在Codeigniter语法中转换Mysql查询的方式类似于WHERE OR,并且有效

时间:2019-05-24 07:33:57

标签: php mysql codeigniter-3

我正在寻求将此MySQL查询隐蔽到Codeigniter语法中,以用于所有in函数。

SELECT * FROM `task` WHERE (status='0' AND priority='0' AND close_request='0') AND (emp_id='8' OR ass_id='8')

我尝试但不起作用:

  $Arr1['close_request']='0';
  $Arr1['priority']='0';
  $Arr1['status']='0';

  $Arr2['emp_id']=8;
  $Arr2['ass_id']=8;

  $this->db->where($Arr1);
  $this->db->where_in($Arr2);
  $query = $this->db->get('task');
  $result = $query->result_array(); // as array
  print_r ($result);

0 个答案:

没有答案