Database Eror- Codeigniter PHP

Capture-gghgh.pngCapture gghgh.PNGCapture-sasss.pngCapture sasss.PNGcontrollers : C_data_barang.php 

public function tambah_aksi()
{
$nama_barang = $this->input->post('nama_barang');
$keterangan = $this->input->post('keterangan');
$kategori = $this->input->post('kategori');
$harga = $this->input->post('harga');
$stok = $this->input->post('stok');
$gambar = $_FILES['gambar']['name'];
if ($gambar =''){}else{
$config ['upload_path'] = './img';
$config ['allowed_types'] = 'jpg/jpeg/png/gif';


$this->load->library('upload', $config);
if(!$this->upload->do_upload('gambar')){
echo "Gambar Gagal diUpload!";
}else {
$gambar = $this->upload->data('file_name');
}

$data = array(
'nama_barang'   => $nama_barang,
'keterangan' => $keterangan,
'kategori' => $kategori,
'harga' => $harga,
'stok' => $stok,
'gambar' => $gambar
);

$this->model_barang->tambah_barang($data, 'barang');
redirect('c_data_barang/index');
}
}
}


avatar pashaeshabirina_google

@pashaeshabirina_google

2 Kontribusi 0 Poin


Jawaban

name di tag inputnya di sesuaikan sama yg di ambil di $this->input->post("name_sama_dengan_di_tag_input")
avatar jcdev

@jcdev

72 Kontribusi 14 Poin


Login untuk gabung berdiskusi