更新codeigniter中的多个记录

I am working on a CodeIgniter project where i have to change the status of record. Actually I have to update only those records whose id are/is in the ids sting.

Currently, only one record is updated with my code. My model function is:

public function markUnRead() {
    $ids = 1,2,3,4,5,6;
    $update = array('status' => 0);
    $this->db->where_in('id', $ids);
    $this->db->update('tableName',$update);

    if ($this->db->affected_rows() > 0) {
        return true;
    } else {
        return false;
    }
}

Someone help me please.

The second parameter of where_in() method should be an array:

$this->db->where_in('id', array(1,2,3,4,5,6));

By any reason, if the $ids is an string like "1,2,3,4,5,6", you could get it to work by:

$ids = explode(',', $ids);
$this->db->where_in('id', $ids);