2016-04-22 24 views
0

助けてください。Codeigniterに引数がありません

この私のエラー問題エラー:

enter image description here

私は私が右のチュートリアルに従うと思うが、私は私のコントローラがあり、私のコードから何が間違って

知らない

public function edit($id){ 
    $where = array('id' => $id); 
    $data['barang'] = $this->model_barang->edit($where,'barang')->results(); 
    $this->load->view('edit',$data); 
} 
public function update(){ 
    $id = $this->input->post('id'); 
    $jenis = $this->input->post('jenis'); 
    $nama = $this->input->post('nama'); 
    $harga = $this->input->post('harga'); 
    $pemasok = $this->input->post('pemasok'); 

    $data = array (
     'jenis' => $jenis, 
     'nama'=> $nama, 
     'harga' => $harga, 
     'pemasok' => $pemasok 
    ); 

    $where = array(
     'id' => $id 
    ); 

    $this->model_barang->update($where,$data,'barang'); 
    redirect('barang/tampil'); 
} 

m Y モデル、私は私のモデルはあなたがコントローラに$のIDを渡す必要がエラーに

public function edit($where,$table) { 
    return $this->db->get($table,$where); 
} 
public function update($where,$data,$table){ 
    $this->db->where($where); 
    $this->db->update($table,$data); 
} 
+0

のようなものでなければなりません 'パブリック関数の編集のような($のID = NULL){/ **コード** /}'やメソッドの内部で値を扱う – Girish

答えて

0

を示していないと思います。 のparamsでパスのデフォルト値を警告防ぐために、このhttp://domain.com/barang/edit/1

+0

OWH。私はtutorian.okeのおかげでどちらかを失った。 – Qotada

+0

私の答えがあなたに役立つと思うなら、これを受け入れられた答えとしてください。 – otezz

+0

おかげで、私の喜び – Qotada

関連する問題