Welcome Guest, Not a member yet? Register   Sign In
I need some help making a search function involving mulitple paramters
#2

[eluser]Matalina[/eluser]
I would use active record it will eliminate your need to write if else statements, instead you can just write an if post item exists then do this. No other if/else required.

Code:
public function getJobSeekers()
{
list($this->input->post());
if ($this->input->post('position')) {
  $this->db->join('user_resume','user_id = user_resume_user WHERE user_resume_position = '.$position);
}
if ($this->input->post('state')) {
    $this->db->where('user_state',$state);
}
if ($this->input->post('city')) {
    $this->db->where('user_city',$city);
}
if ($this->input->post('skills')) {
    $skill = explode(',', $skills);
    foreach ($skill as $value) {
   $this->db->like('user_resume_skills',$value);
    }
}
$this->db->limit($limit,$offset);
$query = $this->db->get('user');
$result = $query->result_array();
return $result;
}

You could also use this at the top:

Code:
list($this->input->post(NULL, TRUE));


Messages In This Thread
I need some help making a search function involving mulitple paramters - by El Forum - 06-19-2012, 06:12 AM



Theme © iAndrew 2016 - Forum software by © MyBB