Welcome Guest, Not a member yet? Register   Sign In
Fatal error: Call to a member function get() on a non-object in
#1

[eluser]Jason McCallister[/eluser]
I am running through the video tutorial for CI and ran into this problem:

Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined property: Blog::$db

Filename: controllers/blog.php

Line Number: 14


Fatal error: Call to a member function get() on a non-object in /Applications/xampp/xamppfiles/htdocs/xampp/codeignitor/system/application/controllers/blog.php on line 14

Here is the blog.php controller; for some reason it hates get. Any ideas?

Code:
<?php

class Blog extends Controller {
    
    function Blog()
        {
            parent::Controller();
    
        }
    function index()
        {
            $data['title'] = "My First CodeIgniter Site";
            $data['heading'] = "Heading Goes Here";
            $data['entry'] = $this->db->get('entries');
            
            $this->load->view('blog_view', $data);
        }
    
}

?>
#2

[eluser]srobet[/eluser]
Have you load the database library ?
#3

[eluser]Jason McCallister[/eluser]
I found the fix. It's working. Thanks srobet! I didn't think to look at the autoload.php. I made the file "exactly" as the video tut. Apparently the tag has been deprecated. (Not To Self: Read the comments in the files!) . The video is obviously a little old, good learning and troubleshooting experience though.

I am new at CI so I am looking forward to getting started!
#4

[eluser]Colin Williams[/eluser]
Quote:The video is obviously a little old, good learning and troubleshooting experience though.

No kidding. This isn't the first problem I've seen caused by the old video tuts. Time for an update, for sure.
#5

[eluser]Jason McCallister[/eluser]
Im sure everyone is busy with EE 2.0. I am pretty anxious for CI and EE to be released. I think that there is going to be a huge increase in the user base and the flexibility.

Does anyone know if CI is going to have a major update to 2.0 or will it still be 1.6.3?
#6

[eluser]Colin Williams[/eluser]
Quote:Does anyone know if CI is going to have a major update to 2.0 or will it still be 1.6.3?

Don't know, but it's all there in the SVN repo. Maybe they already have the version set in the codeigniter.php file... If not, one could probably take a peak around and assume whether or not it warrants a major version update.

My guess is EE 2.0 built on CI 2.0 is likely, if only for marketing reasons.




Theme © iAndrew 2016 - Forum software by © MyBB