using CI I'm trying to set up query with three parameters: user_id, content_type and content_id in which content_id is array of IDs.
So I need to get up with something like this:
SELECT name FROM content WHERE user_id = 2 AND content_type = file AND (content_id = 4 OR content_id = 5 OR content_id = 7 ...).
- question: is this right query to get all the content_ids?
-
does CI have any function where I can say
$this->db->select('name'); $this->db->from('content'); $this->db->where('user_id', $user_id); $this->db->where('content_ids', $content_ids); $this->db->where('content_type', $content_type);
just so that middle where clause is actually where with nested ORs in between and its filled with associative array ($content_ids)?
Thank you for answers.
EDIT: I have found a solution: where_in command does exactly what I need.