[eluser]Tetek[/eluser]
hi everyone
I'm new and I have just started to learning Code Igniter. I have a problem with the blog tutorial. I have all the same as on the film but all time I have this on my screen:
Quote:A PHP Error was encountered
Severity: Notice
Message: Undefined property: Blog::$db
Filename: controllers/blog.php
Line Number: 15
Fatal error: Call to a member function get() on a non-object in C:\xampp\htdocs\system\application\controllers\blog.php on line 15
Code from blog.php
Code:
<?php
class Blog extends Controller {
function Blog()
{
parent::Controller();
}
function index()
{
$data['title'] = "My Blog Title";
$data['heading'] = "My Blog Heading";
$data['query'] = $this->db->get('entries');
$this->load->view('blogview', $data);
}
}
?>
From blogview
Code:
<html>
<head>
<title><?=$title?></title>
</head>
<body>
<h1><?=$heading?></h1>
<?php foreach($query->result() as $row):?>
<h3><?=$row->title?></h3>
<p><?=$row->body?></p>
<hr>
<?php endforeach;?>
</body>
</html>
autoload
Code:
$autoload['core'] = array('database');
database
Code:
$active_group = "default";
$db['default']['hostname'] = "localhost";
$db['default']['username'] = "root";
$db['default']['password'] = "";
$db['default']['database'] = "blog";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['active_r'] = TRUE;
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
And I don't know where is a mistake ;(
Please help!
greetz Tetek