我在控制器中有这样的功能。我需要将结果从$data1['hasil1']
tampilInduk 插入。
public function sikap(){
$person=$this->session->userdata('idperson');
$data1['hasil1']=$this->M_Guru->tampilNik($person);
$data2['hasil2']=$this->M_Guru->tampilInduk($data1);
$this->load->view('sidebarGuru');
$this->load->view('navbarGuru');
$this->load->view('kompetensiSikap',$data1+$data2);
}
我有这样的模型代码
public function tampilInduk($data1){
$this->db->select('induk');
$this->db->from('kelas b');
$this->db->join('siswa_kelas c','c.namakelas= b.namakelas','c.thnakademik=b.thnakademik','c.kdtingkat=b.kdtingkat','right');
$this->db->where('nik',$data1);
$data = $this->db->get(); //mengambil seluruh data
return $data->result();
}
public function tampilNik($person){
$this->db->select('nik');
$this->db->from('guru');
$this->db->where('idperson',$person);
$data=$this->db->get();
return $data->row()->nik;
}
但是错误说变量需要先转换为字符串。你能帮我如何将数组转换为字符串吗?