So i have a searchbox to search in my factories table. it works like a charm, but i'm still new to codeigniter.
Do i need to use a select to select more than one table in my database?
My controller function:
function search()
{
$this->load->view('views/header');
$this->load->view('views/search');
$this->load->view('views/footer');
}
function searchresults()
{
$match = $this->input->post('search');
$data['query'] = $this->bedrijven_model->get_search($match);
$this->load->view('views/header');
$this->load->view('views/searchresults', $data);
$this->load->view('views/footer');
}
My model:
function get_search($match)
{
$this->db->like('Bedrijfsnaam', $match);
$this->db->or_like('Postcode', $match);
$this->db->or_like('Plaats', $match);
$this->db->or_like('Telefoonnummer', $match);
$this->db->or_like('Email', $match);
$this->db->or_like('Website', $match);
$this->db->or_like('Profiel', $match);
$this->db->or_like('Adres', $match);
$query = $this->db->get('bedrijven');
return $query->result();
}
I'm also wondering if you can put your searchfunction from the model into the controller. because then i need to make a new model function for each table.
Thanks in advance.