I have a query that stores result of query like
$this->load->model('person/person_model');
$data['result'] = $this->person_model->get('tbl_person', array('id_person' => $some_key),TRUE);
this will return all the fields of person with $some_key
(id,name,email...)
Then I need to pass $data but before I would like to use name and email of that result
so
$this->load->model('person/other_person_job_model');
$status= $this->other_person_job_model->get('tbl_other_person',array('name'=> ? ),TRUE);
Then I could use $status['name']
or $status['email']
What should I put instead of ? in the example above?
Should I use $data['result']['name']
or something like that?
the get function is:
function get($table,$where=array(),$single=FALSE) {
$q = $this->db->get_where($table,$where);
$result = $q->result_array();
if($single) {
return $result[0];
}
return $result;
}
you could use variable, like:
$this->load->model('person/person_model');
$result = $this->person_model->get('tbl_person', array('id_person' => $some_key),TRUE);
$data['name'] = $result->name;
$data['result'] = $result;
//and
$this->load->model('person/other_person_job_model');
$status= $this->other_person_job_model->get('tbl_other_person',array('name'=> $result->name ),TRUE);