[eluser]Mellkior[/eluser]
Two Examples for Model.
Using Active Record - First Example
$ids = array(1,2,3,4,5,6,7); // Your array
$this->db->select('*');
$this->db->where_in('field', $ids);
$query = $this->db->get('table');
// Query = SELECT * from table WHERE field in (1,2,3,4,5,6,7)
return $query->result();
Using PHP - Second Example
$ids = array(1,2,3,4,5); // Your Array
$sql = 'SELECT * from table WHERE field in (';
for($i =0; $i < count($ids); $i++)
{
if($i == 0)
{
$sql .= $ids[$i];
}
else
{
$sql .= ',' . $ids[$i];
}
}
$sql .= ')';
// SQL = SELECT * from table WHERE field in (1,2,3,4,5)
$query = $this->db->query($sql);
return $query->result();