2017-09-23 76 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); 
} 

錯誤調用未定義的方法Product_model ::產品()在行

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

你的帖子主要是代碼,請嘗試添加一些細節。 –

+3

顯示產品型號代碼。編輯和刪除與應用程序無關的版本標籤。 – Tpojka

+2

這並不需要一個天才來弄清楚錯誤告訴你什麼。產品模型或者有產品方法,或者沒有產品方法,而這個錯誤說明它沒有。你期望什麼? –

回答

0

你得到這個錯誤,因爲。您的模型即「product_model」不包含任何產品功能。 因此,你會得到「調用未定義的方法Product_model :: product()」錯誤

相關問題