Модель:
Код: Выделить всё
public function search_homeowner($searchquery)
{
$this->db
->select('*')
->from('accounts')
->where('role', 0)
->where('isActive', 1);
$this->db->like('firstname', $searchquery, 'after');
$this->db->or_like('lastname', $searchquery, 'after');
$this->db->or_like('username', $searchquery, 'after');
$this->db->or_like('address', $searchquery, 'after');
$query = $this->db->get();
if ($query->num_rows() > 0) {
return $query->result();
} else {
return $query->result();
}
}
Код: Выделить всё
public function search_homeowner()
{
$this->load->model('model_accounts');
$searchquery = $this->input->post('search');
if (isset($searchquery) and !empty($searchquery)) {
$data['users'] = $this->model_accounts->search_homeowner($searchquery);
$data['main_content'] = 'view_adminaccounts';
$data['homeownerlinks'] = '';
$this->load->view('includes/admin_accounts_template', $data);
} else {
redirect('admin_accounts/homeowner');
}
}


Подробнее здесь: https://stackoverflow.com/questions/414 ... odeigniter