controller

public function add_package()
    {
       $this->load->model('admin_model');
      $this->Admin_model->add_packages($package);
    }

admin_model.php

    class Admin_model extends CI_Model
    {
      public function add_packages($data)
        {
            return $this->db->insert('george_packges',$data);
        }
}

Why i will getting this error Undefined property: Admin::$Admin_model and also this

fatal error: Call to a member function add_packages() on null in C:\xampp\htdocs\holiday\application\controllers\Admin.php on line 130

Blessan Kurien

Ответов: 1

Ответы (1)

Change the loading model variable as the model loaded and used was different so the variable was not matching.

$this->Admin_model->add_packages($package);//currently used

$this->admin_model->add_packages($package);

2022 WebDevInsider