我正在寻找Codeigniter中的查询,就像OR或AND一样。
这很完美!
$srcArr2['emp_id']=8;
$srcArr2['status']='2';
$this->db->where($srcArr2);
$query = $this->db->get('tickets');
$res = $query->result_array(); // as array
print_r ($res);
查询是:
需要在$ srcArr1 ['ass_id'] = 12的位置添加OR; 我尝试但不工作。
$srcArr1['ass_id']=12;
$srcArr2['emp_id']=8;
$srcArr2['status']='2';
$this->db->where($srcArr2);
$this->db->where_in($srcArr1);
$query = $this->db->get('tickets');
$res = $query->result_array(); // as array
print_r ($res);
谢谢,提前寻求帮助
答案 0 :(得分:1)
答案 1 :(得分:1)
$this->db->where($srcArr2);
$this->db->or_where($srcArr1);
https://www.codeigniter.com/user_guide/database/query_builder.html#looking-for-specific-data enter link description here