<?php
class Autocomplete_model extends CI_Model {

   public function companies() {
        $term = '';
        if (isset($_GET['query'])) {
            $term = trim(strip_tags($_GET['query']));
        }

        $this->db->select('company,vat,userid');
        $this->db->distinct();
        $this->db->like('company', $term , 'both');
        $this->db->or_like('vat', $term , 'both');
        
        $this->db->order_by('clients.company', 'ASC');
        $this->db->limit(10);
        return $this->db->get('clients')->result();
   }

}
