I am so used to straight writing of queries rather than using ORM's that it's a little confusing.
I have this query:
SELECT *
FROM my_table
WHERE ((a_id = xx OR b_id = xx) AND (a_id = zz OR b_id = zz))
AND active = 1
Basically, I have a table where I have 2 users associated with one another, but multiple users so I need to make sure the connection is there and specifically between the 2 where the active flag is what it is.
However, I'm not sure how to handle that query in CI's ORM so I am seeking some guidance on the issue.
Try the following code
$this->db->select('*');
$this->db->where('(a_id = "xx" or b_id = "xx")';
$this->db->where('(a_id = "zz" or b_id = "zz")';
$this->db->where('active', '1');