Welcome Guest, Not a member yet? Register   Sign In
Help with Controller
#3

[eluser]Unknown[/eluser]
Thanks for the reply, TheFuzzy0ne.

Btw here's my code for site_model:

Code:
class Site_model extends CI_Model
{
function get_events()
{
  $q = "SELECT * FROM calendar";
  
  $query = $this->db->query($q);
  
  if ($query->num_rows() > 0)
  {
   foreach($query->result() as $row)
   {
    $data[] = $row;
   }
   return $data;
  }
}
}

I also put the error_reporting, and just shows the same error.

Fatal error: Call to a member function get_events() on a non-object in ...\Rustedsoul\application\controllers\admin.php on line 24

No, I am not using MAC. And my PHP version is: PHP Version 5.4.7

Well, at first I only call the first model "gallery model" and everything works fine. So I proceeded to the next model and load it in my function and also access the method just like the ones I did before.
After having these:

Code:
$this->load->model('gallery_model');
$this->load->model('site_model');
  
$data = array();
  
$data['images'] = $this->gallery_model->get_images();
$data['events'] = $this->site_model->get_events();

$this->load->view('admin/editor', $data);

The error appeared, and I'm stuck on this.

Thanks for your response, btw.


Messages In This Thread
Help with Controller - by El Forum - 05-22-2013, 02:23 AM
Help with Controller - by El Forum - 05-22-2013, 04:19 AM
Help with Controller - by El Forum - 05-22-2013, 07:54 PM
Help with Controller - by El Forum - 05-23-2013, 07:24 AM



Theme © iAndrew 2016 - Forum software by © MyBB