[eluser]matches[/eluser]
Hello,
I am still pretty new to CI. I am trying to update a users table with the following code
Code:
class register extends Controller {
function register()
{
parent::Controller();
$this->load->helper('url');
$this->load->helper('form');
}
function index()
{
$this->load->view('register/index');
}
function loadData()
{
$this->db->insert('users', $_POST);
}
}
But getting this error:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: register::$db
Filename: controllers/register.php
Line Number: 27
Fatal error: Call to a member function insert() on a non-object in C:\xampp\htdocs\TEST\system\application\controllers\register.php on line 27
This is line 27 in the code above:
$this->db->insert('users', $_POST);
Thanks for any help!