Bantu error array to string conversion

    function addAsesi()
    {
    $data['asesi'] = $this->m_editor->get_data('asesi')->result();
    $data['negara'] = $this->db->query("select * from negara where status = 1")->result();
    $data['tuk'] = $this->db->query("select * from asesi_tuk where status = 1")->result();

        $data['site'] ='LSP-Login';
    $this->load->view('temp/head');
    $this->load->view('temp/nav',$data);
    $this->load->view('temp/sidebar');
    $this->load->view('page/add_asesi', $data);
    $this->load->view('temp/foot');
    }

    function addAsesi_act()
    {
        $name_p = $this->input->post('name_p');
        $no_ktp = $this->input->post('no_ktp');
        $kota_asl = $this->input->post('kota_asl');
        $tgl_lahir = $this->input->post('tgl_lahir');
        $pendidikan = $this->input->post('pendidikan');
        $blk_asl = $this->input->post('blk_asl');
        $country = $this->input->post('country');
        $tuk = $this->input->post('tuk');
        $status = $this->input->post('status');

        $this->form_validation->set_rules('name_p','Nama Asesi','required');
        $this->form_validation->set_rules('no_ktp','No KTP','required|min_length[4]');
        $this->form_validation->set_rules('kota_asl','Kota Asal','required');
        $this->form_validation->set_rules('blk_asl','Asal BLK','required');

        if($this->form_validation->run() != false ){
            //configurasi upload Gambar
        $config['upload_path'] = './assets/upload/';
        $config['allowed_types'] = 'jpg|png|jpeg';
        $config['max_size'] = '2048';
        $config['file_name'] = 'gambar'.time();

        $this->load->library('upload',$config);

        if($this->upload->do_upload('foto')){
        $image = $this->upload->data();
        $data = array( // error dari sini
            'name_p' => $name_p,
            'no_ktp' => $no_ktp,
            'kota_asl' => $kota_asl,
            'tgl_lahir' => $tgl_lahir,
            'pendidikan' => $pendidikan,
            'blk_asl' => $blk_asl,
            'country' => $country,
            'tuk' => $tuk,
            'gambar' => $gambar.['file_name'],
            'status' => 1


avatar padl01
@padl01

1 Kontribusi 0 Poin

Diperbarui 5 tahun yang lalu

Tanggapan

Bisa di sertakan pesan errornya ? ada di baris berapa

1 Jawaban:

  1. variabel $gambar belum belum dideklarasikan, mungkin maksudnya ke $image
  2. di key 'gambar' tidak perlu tanda dot langsung saja $gambar['file_name']

cmiiw

avatar anandap7
@anandap7

7 Kontribusi 6 Poin

Dipost 5 tahun yang lalu

Login untuk ikut Jawaban