Here my table looks like this
i want to get all the departments if location_id
is 3
that means if location id 3
is used i need to get the department_names of cardiology
and hair
so that i had done my code like this
My controller
looks like this
public function get_location_departments()
{
$d = $_POST['location'];
$data['departments'] = $this->Hospital_model->get_location_departments($d);
$this->load->view('frontend/ajax_get_departments',$data);
}
My model
looks like this
public function get_location_departments($d)
{
$this->db->where_in('location_id',$d);
$query=$this->db->get('department')->result();
return $query;
}
Please help me to solve my problem