Welcome Guest, Not a member yet? Register   Sign In
Hi, I need some help with this.
#1

[eluser]aircraft[/eluser]
Hey, I downloaded this framework today, and I must say, I never been into frameworks before. But this is great!

Eitherway, I'm following your tutorial on how to set up a blog, to get the basic idea, then use the framework to do magic.

I have gotten to the part where I am about to display my entries from my database, and I keep getting this error:

Quote:Fatal error: Call to a member function on a non-object in /home/sites/danielmalmqvist.info/public_html/system/application/controllers/blog.php on line 16

Line 16 in blog:
Quote:$data['query'] = $this->db->get('entries');

Note that everything else worked just fine, the scaffolding and such, but I just can't get this to work. So I came here hoping for someone to help me along.

Thanks.
#2

[eluser]gtech[/eluser]
Hello, It looks to me like your config/database.php is not set up correctly as the db instance has not been initialised (I may be wrong, just a hunch).

which db are you using?

can we see blog.php?
#3

[eluser]schnoodles[/eluser]
Either that or you dont have access to $this. is that getting called in a controller or model ?
#4

[eluser]aircraft[/eluser]
Quote:Hello, It looks to me like your config/database.php is not set up correctly as the db instance has not been initialised (I may be wrong, just a hunch).

As the scaffolding worked, I assume the databasee config is set up correctly.

This is my blog.php page,

Code:
<?php

class Blog extends Controller    {
    
    function Blog()
    {
        parent::Controller();

    }
    
    
    function index()
    {

        $data['title'] = "Daniel Malmqvist";
        $data['query'] = $this->db->get('entries');
        
        $this->load->view('blog_view', $data);
    }
}

?>
#5

[eluser]gtech[/eluser]
The controller looks fine


another tip I learned the other day is you can set the log_threashold=2 (or 1 if to many error messages appear) in you config.php file.

then logs appear in the /log directory of your installation, hopefully it should tell you where its keeling over.
#6

[eluser]schnoodles[/eluser]
Makes sure you included the database into the autoloader seeing as you are not doing $this->load->library('database'); in that function index() { }
#7

[eluser]aircraft[/eluser]
I do have the database in the autoloader.

As I said, I followed the tutorial, I did everything the dude in the tutorial did. Sad
#8

[eluser]gtech[/eluser]
did you look at the logs?
#9

[eluser]aircraft[/eluser]
I did, and there is nothing in the logs folder.
#10

[eluser]CI Lee[/eluser]
Call me weird.. but can I see your view?

It may be late, and I may be being slow but...


-Lee




Theme © iAndrew 2016 - Forum software by © MyBB