Welcome Guest, Not a member yet? Register   Sign In
Getting erro when I try to insert into data to db
#1

[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!


Messages In This Thread
Getting erro when I try to insert into data to db - by El Forum - 07-04-2008, 02:50 PM
Getting erro when I try to insert into data to db - by El Forum - 07-04-2008, 03:44 PM



Theme © iAndrew 2016 - Forum software by © MyBB