Database Eror- Codeigniter PHP

Capture gghgh.PNGCapture sasss.PNG

controllers : 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

Diperbarui 3 tahun yang lalu

1 Jawaban:

<div>name di tag inputnya di sesuaikan sama yg di ambil di $this-&gt;input-&gt;post("name_sama_dengan_di_tag_input")</div>

avatar jcdev
@jcdev

72 Kontribusi 14 Poin

Dipost 3 tahun yang lalu

Login untuk ikut Jawaban