Welcome Guest, Not a member yet? Register   Sign In
Invalid argument supplied for foreach()
#7

[eluser]SaSa[/eluser]
thanks, but there is still problem, if use of $files = (array) $this->multi_upload->go_upload(); or if ($files !== FALSE) or if(is_array($files)) always is this messag(return false): The upload path does not appear to be valid. if use of if (count($files) > 0) same error show me:
Code:
A PHP Error was encountered

Severity: Warning

Message: Invalid argument supplied for foreach()

Filename: admin/tour.php

Line Number: 81

my CI_Controller:
Code:
function insert_data(){
        $jdate = jgmdate("j F Y");
        /*////////////////////////////////////*/
        $useradmin = $this->session->userdata('login');
        $query = $this->db->get_where('login', array('useradmin' => $useradmin))->row();
        $nameadmin = $query->nameadmin;
        $lastnameadmin = $query->lastnameadmin;
        //////////////////////////////////////////
        $config['upload_path'] = './uploads/'; // server directory
        $config['allowed_types'] = 'gif|jpg|png'; // by extension, will check for whether it is an image
        $config['max_size']    = '1000'; // in kb
        $config['max_width']  = '1024';
        $config['max_height']  = '768';
        
        $this->load->library('upload', $config);
        $this->load->library('Multi_upload');
                
        $files = $this->multi_upload->go_upload();
        if (count($files) > 0){
            $images = array();
            foreach ($files as $img) {
              $images[] = $img['file'];
            }
        }else{
            
            //$error = array('error' => $this->upload->display_errors());
            //$this->load->view('admin/tour_foreign_insert', $error);
            //$data['error'] = $this->upload->display_errors();
            $this->session->set_flashdata('error', $this->upload->display_errors());
            //$this->load->view('admin/tour_foreign_insert',$data);
            //sleep(5);
            redirect('admin/tour/insert_foreign', 'refresh');
        }                    
        ///////////////////////////////////////////
        $data = array (
                'name' => $this->input->post('name'),
        'term' => $this->input->post('term'),
        'hotel' => serialize($this->input->post('hotel')),
        'guide' => serialize($this->input->post('guide')),
        'airline' => serialize($this->input->post('airline')),
        'time_go' => $this->input->post('time_go'),
        'time_back' => $this->input->post('time_back'),
        'date_go' => $this->input->post('date_go'),
        'date_back' => $this->input->post('date_back') ,
                'service' => serialize($this->input->post('service')),
        'description' => $this->input->post('description'),
                'surf' => serialize($this->input->post('surf')),
                'type' => $this->input->post('type'),
        'terminal' => $this->input->post('terminal'),
        'degree' => $this->input->post('degree'),
        'first_terminal' => $this->input->post('first_terminal'),
        'end_terminal' => $this->input->post('end_terminal'),
        'image' => serialize($images),
                'date_submit' => $jdate,
        'useradmin_submit' => $nameadmin.' '.$lastnameadmin ,
    );
    $this->db->insert('tour_foreign', $data);
    }
what do i do?


Messages In This Thread
Invalid argument supplied for foreach() - by El Forum - 07-27-2011, 04:56 AM
Invalid argument supplied for foreach() - by El Forum - 07-27-2011, 05:07 AM
Invalid argument supplied for foreach() - by El Forum - 07-27-2011, 09:22 AM
Invalid argument supplied for foreach() - by El Forum - 07-27-2011, 02:25 PM
Invalid argument supplied for foreach() - by El Forum - 07-27-2011, 03:36 PM
Invalid argument supplied for foreach() - by El Forum - 07-27-2011, 04:15 PM
Invalid argument supplied for foreach() - by El Forum - 07-28-2011, 02:53 AM
Invalid argument supplied for foreach() - by El Forum - 07-28-2011, 05:36 AM
Invalid argument supplied for foreach() - by El Forum - 07-28-2011, 06:26 AM
Invalid argument supplied for foreach() - by El Forum - 07-28-2011, 07:42 AM
Invalid argument supplied for foreach() - by El Forum - 07-28-2011, 08:28 AM
Invalid argument supplied for foreach() - by El Forum - 07-28-2011, 08:34 AM
Invalid argument supplied for foreach() - by El Forum - 07-28-2011, 09:39 AM
Invalid argument supplied for foreach() - by El Forum - 07-28-2011, 12:03 PM
Invalid argument supplied for foreach() - by El Forum - 07-28-2011, 12:05 PM
Invalid argument supplied for foreach() - by El Forum - 07-29-2011, 12:49 AM
Invalid argument supplied for foreach() - by El Forum - 07-29-2011, 07:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB