[eluser]Nuage[/eluser]
First of all hello to everybody,
I am a really really newbie.. I have been coding PHP for a few years. Also can be considered as a new OOP programmer.. Anyway, i have been reading and watching the tutorials of CI.
I am trying to do the blog thing.
this is my 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('blog_view', $data);
}
}
?>
and this is my blog_view.php
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>
but i get
Code:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Blog::$db
Filename: controllers/blog.php
Line Number: 13
error. Why is that? I have done what it says on the tutorial video..
Thanks in advance.