Postingan lainnya
gagal melakukan update ke database di codeigniter 4 tetapi di view berhasil
controllernya
public function update($product_id)
{
$data=[
'product_name'=>$this->request->getPost('product_name'),
'product_description'=>$this->request->getPost('product_description'),
];
$this->ProductModel->update_product($data, $product_id);
session()->setFlashdata('success', 'Data Berhasil di Update');
return redirect()->to(base_url('product'));
}
}
0
1 Jawaban:
<pre>modelnya
public function update_product($data, $product_id) { return $this->db->table('product')->update($data,array('product_id',$product_id)); }</pre>
0