[eluser]Brad Morse[/eluser]
I am doing the Weblog tutorial and I have scanned all the code and everything is exact.
The scaffolding part worked, I entered a couple entries, so it connects to the db just fine, but I get this error:
Fatal error: Call to a member function on a non-object in (path URL) on line 14
This is line 14:
Code:
$data['query'] = $this->db->get('entries');
Here is the blog controller page:
Code:
<?php
class Blog extends Controller {
function Blog() {
parent::Controller();
//$this->load->scaffolding('entries');
}
function index() {
$data['title'] = "My Blog Title";
$data['heading'] = "My Blog Heading";
$data['query'] = $this->db->get('entries');
$this->load->view('blog_view', $data);
}
}
?>
Here is the blog view page:
Code:
<html>
<head>
<title><?=$title?></title>
</head>
<body>
<h1><?=$heading?></h1>
<?php foreach($query->result() as $row): ?>
<h3><?=$row->title?></h2>
<p><?=$row->body?></p>
<hr>
<?php endforeach; ?>
</body>
</html>
Any help is appreciated.