Assalamualaikum,.. yahhh pastinya error lah jika bikinnya seperti diatas gan, saya sudah contohkan pada komentar diatas bikinnya begini : if ($hasil['file_name']==''){ if ($hasil_video['file_name']==''){ 'video'=>'', }else{ 'video'=>$hasil_video['file_name'], } }else{ } kalau diisi querynya jadinya seperti ini yang benar : function tambah_video(){ cek_session_akses('video',$this->session->id_session); if (isset($_POST['submit'])){ $config['upload_path'] = 'asset/img_video/'; $config['allowed_types'] = 'gif|jpg|png|JPG|JPEG|mp4|MP4'; $config['max_size'] = '3000'; // kb $this->load->library('upload', $config); $this->upload->do_upload('d'); $hasil=$this->upload->data(); $this->upload->do_upload('video'); $hasil_video=$this->upload->data(); if ($this->input->post('f')!=''){ $tag_seo = $this->input->post('f'); }else{ $tag = ''; } if ($hasil['file_name']==''){ if ($hasil_video['file_name']==''){ $data = array('id_playlist'=>$this->input->post('a'), 'username'=>$this->session->username, 'jdl_video'=>$this->input->post('b'), 'video_seo'=>seo_title($this->input->post('b')), 'keterangan'=>$this->input->post('c'), 'video'=>'', 'youtube'=>$this->input->post('e'), 'dilihat'=>'0', 'hari'=>hari_ini (date('w')), 'tanggal'=>date('Y-m-d'), 'tagvid'=>$tag); }else{ $data = array('id_playlist'=>$this->input->post('a'), 'username'=>$this->session->username, 'jdl_video'=>$this->input->post('b'), 'video_seo'=>seo_title($this->input->post('b')), 'keterangan'=>$this->input->post('c'), 'video'=>$hasil_video['file_name'], 'youtube'=>$this->input->post('e'), 'dilihat'=>'0', 'hari'=>hari_ini (date('w')), 'tanggal'=>date('Y-m-d'), 'tagvid'=>$tag); } }else{ if ($hasil_video['file_name']==''){ $data = array('id_playlist'=>$this->input->post('a'), 'username'=>$this->session->username, 'jdl_video'=>$this->input->post('b'), 'video_seo'=>seo_title($this->input->post('b')), 'keterangan'=>$this->input->post('c'), 'gbr_video'=>$hasil['file_name'], 'video'=>'', 'youtube'=>$this->input->post('e'), 'dilihat'=>'0', 'hari'=>hari_ini (date('w')), 'tanggal'=>date('Y-m-d'), 'tagvid'=>$tag); }else{ $data = array('id_playlist'=>$this->input->post('a'), 'username'=>$this->session->username, 'jdl_video'=>$this->input->post('b'), 'video_seo'=>seo_title($this->input->post('b')), 'keterangan'=>$this->input->post('c'), 'gbr_video'=>$hasil['file_name'], 'video'=>$hasil_video['file_name'], 'youtube'=>$this->input->post('e'), 'dilihat'=>'0', 'hari'=>hari_ini (date('w')), 'tanggal'=>date('Y-m-d'), 'tagvid'=>$tag); } } $this->model_app->insert('video',$data); redirect($this->uri->segment(1).'/video'); }else{ $data['record'] = $this->model_app->view_ordering('playlist','id_playlist','DESC'); $data['tag'] = $this->model_app->view_ordering('tagvid','id_tag','DESC'); $this->template->load('administrator/template','administrator/mod_video/view_video_tambah',$data); } } function edit_video(){ cek_session_akses('video',$this->session->id_session); $id = $this->uri->segment(3); if (isset($_POST['submit'])){ $config['upload_path'] = 'asset/img_video/'; $config['allowed_types'] = 'gif|jpg|png|JPG|JPEG|mp4|MP4'; $config['max_size'] = '3000'; // kb $this->load->library('upload', $config); $this->upload->do_upload('d'); $hasil=$this->upload->data(); $this->upload->do_upload('video'); $hasil_video=$this->upload->data(); if ($this->input->post('f')!=''){ $tag_seo = $this->input->post('f'); }else{ $tag = ''; } if ($hasil['file_name']==''){ if ($hasil_video['file_name']==''){ $data = array('id_playlist'=>$this->input->post('a'), 'username'=>$this->session->username, 'jdl_video'=>$this->input->post('b'), 'video_seo'=>seo_title($this->input->post('b')), 'keterangan'=>$this->input->post('c'), 'video'=>'', 'youtube'=>$this->input->post('e'), 'tagvid'=>$tag); }else{ $data = array('id_playlist'=>$this->input->post('a'), 'username'=>$this->session->username, 'jdl_video'=>$this->input->post('b'), 'video_seo'=>seo_title($this->input->post('b')), 'keterangan'=>$this->input->post('c'), 'video'=>$hasil_video['file_name'], 'youtube'=>$this->input->post('e'), 'tagvid'=>$tag); } }else{ if ($hasil_video['file_name']==''){ $data = array('id_playlist'=>$this->input->post('a'), 'username'=>$this->session->username, 'jdl_video'=>$this->input->post('b'), 'video_seo'=>seo_title($this->input->post('b')), 'keterangan'=>$this->input->post('c'), 'gbr_video'=>$hasil['file_name'], 'video'=>'', 'youtube'=>$this->input->post('e'), 'tagvid'=>$tag); }else{ $data = array('id_playlist'=>$this->input->post('a'), 'username'=>$this->session->username, 'jdl_video'=>$this->input->post('b'), 'video_seo'=>seo_title($this->input->post('b')), 'keterangan'=>$this->input->post('c'), 'gbr_video'=>$hasil['file_name'], 'video'=>$hasil_video['file_name'], 'youtube'=>$this->input->post('e'), 'tagvid'=>$tag); } } $where = array('id_video' => $this->input->post('id')); $this->model_app->update('video', $data, $where); redirect($this->uri->segment(1).'/video'); }else{ $record = $this->model_app->view_ordering('playlist','id_playlist','DESC'); $tag = $this->model_app->view_ordering('tagvid','id_tag','DESC'); if ($this->session->level=='admin'){ $proses = $this->model_app->edit('video', array('id_video' => $id))->row_array(); }else{ $proses = $this->model_app->edit('video', array('id_video' => $id, 'username' => $this->session->username))->row_array(); } $data = array('rows' => $proses,'record' => $record, 'tag' => $tag); $this->template->load('administrator/template','administrator/mod_video/view_video_edit',$data); } }
|