$bindings = array($this->user_id, '%'.$item_name.'%');
$records = $this->db->query($sql, $bindings)->result();
return array(
'records' => $records,
'count' => count($records),
);
Затем в вашем контроллере:
$query = $this->item_model->searchItem($item_name);
$data['records'] = $query['records'];
$data['count'] = $query['count'];