Welcome Guest, Not a member yet? Register   Sign In
Active record insert not work after upload files
#1

[eluser]Triple_vent[/eluser]
Hi...
i got some problem after uploading my file, i am intend to insert all data deals with uploaded files into database (MYSQL) but, i really cannot understand why this dont work at all (even with pure sql query)
here my code :
Code:
function do_upload()
    {
        
        
      
        
       if($this->upload->do_upload('Filedata')==TRUE)
       {
        $uploads = array($this->upload->data());
        
        
        
        foreach($uploads as $key[] => $value)
        {
        
        
            $config['image_library'] = 'GD2';
            $config['source_image'] = $value['full_path'];
            $config['create_thumb'] = TRUE;
            $config['thumb_marker'] = '_tn';
            $config['master_dim'] = 'width';
            $config['quality'] = 75;
            $config['maintain_ratio'] = TRUE;
            $config['width'] = 175;
            $config['height'] = 175;
            $config['new_image'] = $upload_path;
            
            
            
            //$this->image_lib->clear();
            $this->image_lib->initialize($config);
            //$this->load->library('image_lib', $config);
            $this->image_lib->resize();
        
            
             //Make Some Variables for Database
            $nama = $value['file_name'];
            $thumbnail = $value['raw_name'].'_tn'.$value['file_ext'];
            $path = $upload_path;
            $tgl = date('Y-m-d');
            $id_aset = $id;

             //Add Pic Info To Database
            $this->db->set('nama', $nama);
            $this->db->set('thumbnail', $thumbnail);
            $this->db->set('path', $path);
            $this->db->set('tgl', $tgl);
            $this->db->set('id_aset', $id_aset);
            

            //Insert Info Into Database
            $this->db->insert('gallery');
            
                        //pure sql query
            $sql = 'INSERT INTO `gallery` (`id`, `id_aset`, `nama`, `path`, `tgl`, `thumbnail`, `default`, `descr`) VALUES (NULL, \'\', \'\', \'\', \'2009-08-03\', \'\', \'0\', \'\')';
            $this->db->query($sql);
      
        }
        
        
        
      }  
        
      
      }

Thanks for replying. have a nice day Smile
#2

[eluser]Triple_vent[/eluser]
Don't Have to answer this,

Good person told me to run the log by enabling it on system/application/config/config.php, and finally i got the error and can debug all the error..

Thanks SolePixel




Theme © iAndrew 2016 - Forum software by © MyBB