Welcome Guest, Not a member yet? Register   Sign In
Tutorial problems: "Call to a member function on a non-object"
#2

[eluser]kyleb[/eluser]
So of course after trying one more thing, this worked (sort of):
Code:
$this->load->database();

Adding it to the Controller seemed to work; now my code looks like this:
Code:
<?php

class Visits extends Controller {

    function Visits()
    {
        parent::Controller();

    }

    function index()
    {
        $this->load->database();

        $data['title'] = "CodeIgniter Testing";
        $data['heading'] = "Testing Visit Table Access";
        $data['query'] = $this->db->get('VISIT');
        
        $this->load->view('visits_view',$data);
    }
}
?>

Now I'm getting:

Code:
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 23 bytes) in...

But that probably makes sense, given that the VISIT table is very large.

Was I missing something in my autoload.php or database.php file that necessitated the database class being instantiated from the controller?


Messages In This Thread
Tutorial problems: "Call to a member function on a non-object" - by El Forum - 12-21-2009, 07:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB