Welcome Guest, Not a member yet? Register   Sign In
HTTP error 500 when loading model

Hi there

I am stuck in a problem with Codeigniter where I am getting a http 500 (Internal Server Error) as soon as I am trying to load a model from my controller. When I comment the loading of the model out, the view loads just fine.

Here is what I have got:

My Controller function (controllers > objects.php):
public function all()

  // gets all objects and displays them
  // -----------------------------------------------

  // get objects from db
  $viewdata['query'] = $this->objects_model->all();

  // load view
  $viewdata['view_content'] = 'objects_all_view';

My model (models > objects_model.php)
function all()
   // gets all objects
   // -----------------------------------------------
   $this->db->select('obj.ID, fv.value');
   $this->db->from('objects obj, fields_values fv, fields_def fd');
   $this->db->where('fv.status = \'active\' AND obj.ID = fv.objects_ID AND fv.fields_def_ID = fd.ID AND fd.name = \'Bezeichnung\'');
   $query = $this->db->get();
   return $query;
  } // end all()

It does not matter if I insert the two lines for loading the model in the index function or in another function such as all() in this example. As soon as I insert these two lines, I get the 500 error.

The 'database' library is autoloaded.

Thank you for any help or hint!

Theme © iAndrew 2016 - Forum software by © MyBB