CodeIgniter Forums
Call to a member function on a non-object - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Call to a member function on a non-object (/showthread.php?tid=12731)



Call to a member function on a non-object - El Forum - 10-29-2008

[eluser]spagi[/eluser]
Hi i have problem
Fatal error: Call to a member function on a non-object in /3w/zaridi.to/s/spagi/system/application/controllers/blog.php on line 17

Code:
<?php
class Blog extends Controller {

  function Blog ()
  {
      parent::Controller();
  
  
  }

  
  function index()
  {
    
  $data['title']="MS Rymarov";
  $data['heading']="MS RYM";
  $data['query']=$this->db->get('clenove');////line 17
  
  $this->load->view('blog_ukaz', $data);
    
  }


}
?>














Can anyone explain what is wrong?


Call to a member function on a non-object - El Forum - 10-29-2008

[eluser]wr5aw[/eluser]
You're not connected to your database. Either add 'database' to the libraries array in application/config/autoload.php or manually load the db in your controller. See - [email=http://ellislab.com/codeigniter/user-guide/database/connecting.html]http://ellislab.com/codeigniter/user-guide/database/connecting.html[/email]


Call to a member function on a non-object - El Forum - 10-29-2008

[eluser]spagi[/eluser]
thanks alot