If using array_unique in php codeigniter, it returns only on value. please give an guideline to solve the issue, I'm new to programming. I'm code is below.
Controllers
function get_rck_detail()
{
$partnumber = $this->input->post('part_number');
$subbrand = $this->input->post('subbrand');
$part = $this->suggest->get_part_code($partnumber);
$rack_list = $this->suggest->get_rack_details($part,$subbrand);
echo '<option>--Location--</option>';
foreach(array_unique($rack_list) as $rack)
{
echo '<option value="'.$rack['rs_loc'].'">'.$rack['rack_name'].'</option>';
}
}
models
function get_rack_details($part,$subbrand)
{
$this->db->select('*');
$this->db->from('rack_spares');
$this->db->join('rack_name','rack_spares.rs_loc = rack_name.rn_id');
$this->db->where('rs_product_code',$part);
$this->db->where('rs_sub',$subbrand);
$query = $this->db->get();
return $query->result_array();
}