Welcome Guest, Not a member yet? Register   Sign In
DB problem
#1

[eluser]pgsjoe[/eluser]
Searched the forum, using the search, before posting! Using my proper web forum etiquette. Could not find anything about it so far. I was doing good, following the tutorial, scaffolding was working, added stuff to the database, then it took a turn for the worse. I'm receiving this error and I just don't know why. Any help, TOTALLY appreciated. Thanks in advance.

Message: Undefined property: Releases::$db

Fatal error: Call to a member function get() on a non-object in /controllers/releases.php on line 14

----------- Looks like it's coming from this line in my code -----------
Code:
$data['query'] = $this->db->get('pressReleases');
#2

[eluser]Seppo[/eluser]
Do you have database class loaded?
Post all your function
#3

[eluser]pgsjoe[/eluser]
I was following the demo, making slight changes as I needed. Here's where I left off when I got the error:
Code:
<?php
class Releases extends Controller {
    
    function Releases()
    {
        parent::Controller();
        
        $this->load->scaffolding('pressReleases');
    }
    function index()
    {
        $data['title']        = "My Blog Title";
        $data['heading']    = "My Blog Heading";
        $data['query']        = $this->db->get('pressReleases');
        
        $this->load->view('pressReleases', $data);
    }
    
    function comments()
    {
        echo 'Look at this!';
    }
}
?>
And like I said, the scaffolding was working, so I know the table name and database connections are correct.
#4

[eluser]Seppo[/eluser]
But do you have it in autoload? you haven't loaded it in the code, and scaffolding loads it
#5

[eluser]pgsjoe[/eluser]
You're my new favorite person. In fact, today, you are my hero. You have just been deemed first 'Hero' of 2008. I only had it loaded in the ['core']. I was just following the tutorial and didn't bother to read the comment above it that says "deprecated, use ['libraries'].

Thanks so damn much for your quick and downright intuitive help. I owe you one!




Theme © iAndrew 2016 - Forum software by © MyBB