if (isset($options['openpos'])) { $this->db->select_sum('openPos'); $this->db->from('requirement'); $this->db->where('(closedPos = 0) '); $query = $this->db->get(); return $query->row()->openpos; }