Good day,everyone! Please, am new to CodeIgniter... Actually,am try to write a search module script using inner join, but I don't know what am not getting right.
This is the error message: An uncaught Exception was encountered Type: ArgumentCountError
Message: Too few arguments to function Career_model::quick_search(), 0 passed in C:\xampp\htdocs\hue\application\controllers\Pages.php on line 69 and exactly 4 expected
Filename: C:\xampp\htdocs\hue\application\models\Career_model.php
Line Number: 124
Backtrace:
File: C:\xampp\htdocs\hue\application\controllers\Pages.php Line: 69 Function: quick_search
File: C:\xampp\htdocs\hue\index.php Line: 286 Function: require_once
This is my controller:
function quick()
{
if ($this->session->userdata('username')):
$session_data = $this->session->userdata('username');
$query = $this->db->query("select * from account where email='$session_data'");
$data = $query->result();
foreach ($data as $key => $value);
$this->form_validation->set_rules('gender','Gender', 'required');
$this->form_validation->set_rules('from','lowest age', 'required');
$this->form_validation->set_rules('to','highest age', 'required');
if ($this->form_validation->run() == FALSE):
$this->load->view('pages/search_result');
else:
$gender = $this->input->get_post('gender');
$from = $this->input->get_post('from');
$to = $this->input->get_post('to');
$country = $value->country;
//I suppose this is where the problem is coming from
if($this->Career_model->quick_search($gender,$from,$to,$country)):
$data = $this->session->set_flashdata('error','something went wrong...');
redirect('pages/search_result',$data);
else:
$result['data'] = $this->Career_model->quick_search();
redirect('pages/search_result',$result);
endif;
endif;
endif;
}
And here is the Model:
function quick_search($gender,$from,$to,$country)
{
$this->db->join("about" , "account.ref_id = about.user_id");
$this->db->where('gender',$gender);
$this->db->where('country',$country);
$this->db->where('age',$from);
$this->db->where('age <=',$to);
$query = $this->db->get('account');
return $query->result();
}
Thanks in advance...