[eluser]rajendiran[/eluser]
Friends,
I am getting the following error when i am trying to connect with database.
Fatal error: Call to a member function get() on a non-object in
this is my source code in blog.php\
<?php
class Blog extends CI_Controller
{
function index()
{
$data['title'] = "My Blog Title";
$data['header'] = "My Blog Heading";
$data['interest'] = array("cricket","chees");
$data['query'] = $this->db->get('entries');
$this->load->view("blog_view", $data);
}
}
?>
blog_view.php code is
<?php
foreach ($query->result() as $row): ?>
<h3><?php echo $row->title; ?> </h3>
<p><?php echo $row->body; ?></p>
<?php endforeach; ?>
please help me solve this error.
Thank you
Rajendiran A