2017-09-23 16 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()"호출 오류가 발생합니다.