0

I am looking for query in Codeigniter works like where OR, AND both works.

This is working Perfect!

$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);

query is:

Need to add OR in where with $srcArr1['ass_id']=12; I try but not working.

$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);

Thank You, in Advance for help

0

2 Answers 2

1

You can use or_where_in to achieve the same,

$this->db->or_where_in($srcArr1);

Official doc.

Sign up to request clarification or add additional context in comments.

Comments

1
$this->db->where($srcArr2);
$this->db->or_where($srcArr1);

https://www.codeigniter.com/user_guide/database/query_builder.html#looking-for-specific-dataenter link description here

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.