In my model there are 2 functions to get data from database. Both return data as arrays of objects.One function is given below.
public function get_camaramens($data,$evdata)
{
$this->db->select('emp_position.employee_id');
$this->db->from('emp_position');
$this->db->where('emp_position.position','c');
$this->db->where('emp_position.employee_id NOT IN ('.implode(",",$data).')');
$query=$this->db->get('',$evdata);
return $query->result();
}
In my controller I accept this result as follows.
$sdata['camaramen_list'] = $this->emp_position_model>get_camaramens($data,$evdata['no_of_cams']);
The other function in the model is
public function get_camara_assistants($data,$sdata,$evdata)
{
$cdata = array();
foreach($sdata['camaramen_list'] as $row) {
$cdata[] = $row->employee_id;
}
$this->db->select('emp_position.employee_id');
$this->db->from('emp_position');
$this->db->where('emp_position.position','ca');
$this->db->where('emp_position.employee_id NOT IN ('.implode(", ",$data).')');
$this->db->where('emp_position.employee_id NOT IN ('.implode(", ",$cdata).')');
$query=$this->db->get('',$evdata);
return $query->result();
}
In my controller I want to add the result of the above function to the same array of objects $sdata. But if I put same name as follows it replace the previous array.
$sdata['camaramen_list'] = $this->emp_position_model->get_camara_assistants($data,$sdata,$evdata['no_of_cams']);
Can anyone tell me correct way please.