diff --git a/fuel/modules/fuel/models/base_module_model.php b/fuel/modules/fuel/models/base_module_model.php index de598c0f2..4088374de 100644 --- a/fuel/modules/fuel/models/base_module_model.php +++ b/fuel/modules/fuel/models/base_module_model.php @@ -204,11 +204,27 @@ function list_items($limit = NULL, $offset = 0, $col = 'id', $order = 'asc') if (strtolower($this->filter_join) == 'and') { - $this->db->like('LOWER('.$key.')', strtolower($val), 'both'); + // do a direct match if the values are integers and have _id in them + if (preg_match('#_id#', $key) AND is_numeric($val)) + { + $this->db->where(array($key => $val)); + } + else + { + $this->db->like('LOWER('.$key.')', strtolower($val), 'both'); + } } else { - $this->db->or_like('LOWER('.$key.')', strtolower($val), 'both'); + // do a direct match if the values are integers and have _id in them + if (preg_match('#_id#', $key) AND is_numeric($val)) + { + $this->db->or_where(array($key => $val)); + } + else + { + $this->db->or_like('LOWER('.$key.')', strtolower($val), 'both'); + } } } } @@ -219,7 +235,6 @@ function list_items($limit = NULL, $offset = 0, $col = 'id', $order = 'asc') $this->db->offset($offset); $query = $this->db->get($this->table_name); $data = $query->result_array(); - return $data; }