[eluser]featureBlend[/eluser]
I am receiving PHP error: Undefined property: Blog::$db - while connecting to my database.
Here is the code i used in the controller blog.php:
Code:
<?php
class Blog extends Controller {
function Blog()
{
parent::Controller();
}
function index()
{
$data['title'] = "Ahad Bokhari loves Code Igniter";
$data['heading'] = "My Blog Heading";
$data['query'] = $this->db->get('entries');
$this->load->view('blog_view', $data);
}
}
?>
and here's the code for the the View file: blog_view.php
Code:
<html>
<head>
<title><?php echo $title; ?></title>
</head>
<body>
<h1><?php echo $heading; ?></h1>
<?php foreach($query->result() as $row): ?>
<h3><?php echo $row->title; ?></h3> //something wrong with my syntax?
<p><?php echo $row->body; ?></p>
<hr>
<?php endforeach; ?>
</body>
</html>
I am not using shorthand codes for php since i am on a local server and dont know how to enable it...Yes i have setup all the files for the database
Any thoughts? I know im a newbie, but the minute i figure out how it works, the rest will become trivial.