2017-09-23 13 views
1
public function save_edit() { 

    parent::__save_edit(); 
    $this->db = $this->load->database('default', true); 
    $this->load->model('product_model','',TRUE); 
    $id = $this->input->post('item_id'); 

    $array_item = array(
     'item_name' => $this->input->post('item_name'), 
     'note' => $this->input->post('item_note'), 
     'stock' => $this->input->post('item_stock'), 
     'price' => $this->input->post('item_price'), 
     'unit' => $this->input->post('item_unit') 
     ); 

    $this->load->model('product_model'); 
    $this->product_model->update($id,$array_item); 
    redirect('index.php/product'); 
} 

public function edit(){ 
     $this->db = $this->load->database('default', true); 
     $this->load->model('product_model'); 
     **$data['product'] = $this->product_model->product($this->uri->segment(3))->row_array();** 
     $this->load->view('index.php/product_edit',$data); 
} 

エラーこのエラーコール::製品()

$data['product'] = $this->product_model->product($this->uri->segment(3))->row_array(); 
+0

あなたの投稿は主にコードなので、詳細を追加してください。 –

+3

製品モデルコードを表示します。アプリケーションに関連しないバージョンタグを編集して削除します。 – Tpojka

+2

エラーがあなたに何を伝えているか把握するのに天才はかかりません。製品モデルにはプロダクトメソッドが含まれているか、プロダクトモデルにはありません。あなたは何を望んでいるのですか? –

答えて

0

あなたのGET行であるため。モデル「product_model」に商品機能は含まれていません。 これで、「定義されていないメソッドの呼び出しProduct_model :: product()」というエラーが表示されます