codeigniter fatal error, trying to read database codeigniter fatal error, trying to read database codeigniter codeigniter

codeigniter fatal error, trying to read database


The above error is occuring because the value of $query is NULL or a non-object. This is likely because get('users') failed to return a proper query.

Make sure your database has a table users and that your database library is initialized and configured correctly.


I agree with Aren.

You should implement some sort of failure checking to gracefully handle this error.

$result = $this->Users_model->get_records();if ($result == null)  echo "error message";else{  // do your normal page handling}