Reputation: 109
I have a model product_model which I am loading in controller function delete. when I run the project I got the error "Call to a member function delete_merchant_products() on a non-object in /home/danish/www/hbs/application/controllers/admin.php on line 173". I am confuse why is this happening. Below is cotroller function code. model name is product_model.
function delete(){
// deleting the merchant data.
$this -> load -> model('merchant_model');
$output = $this -> merchant_model -> get_records();
$list['merchants'] = $output;
$this->load->helper(array('form','url'));
$this->load->library('form_validation');
$this->form_validation->set_rules('txt_merchant_title','Merchant Title','required');
if($this->form_validation->run() == FALSE):
$this->load->view('admin/merchant_delete_view',$list);
else:
$merchant_title = $this->input->post('txt_merchant_title');
$merchant_title = str_replace("-", " ", $merchant_title);
$temp_path = realpath('../hbs/merchants');
$dir = $temp_path .'/'.$merchant_title .'/';
system("rm -rf ".escapeshellarg($dir));
$this->load->model('product_model');
$this->porduct_model->delete_merchant_products($merchant_title);//error.
$this->merchant_model->delete($merchant_title);
echo "Delete successfully";
endif;
}
Upvotes: 0
Views: 32
Reputation: 5387
You have a typo on this line:
$this->porduct_model->delete_merchant_products($merchant_title);//error.
porduct instead of product.
Upvotes: 1