Skip to content

Instantly share code, notes, and snippets.

@jvzammit
Last active August 29, 2015 14:04
Show Gist options
  • Select an option

  • Save jvzammit/c1f2c33b03cccea71539 to your computer and use it in GitHub Desktop.

Select an option

Save jvzammit/c1f2c33b03cccea71539 to your computer and use it in GitHub Desktop.
PHP error

The error below materializes when calling some PHP site URLs directly (e.g. /ajax/questions/process-delete-question):

Fatal error: Call to a member function num_rows() on a non-object in
/var/www/html/noodle/noodle_ci/application/models/config_model.php on line 76

It's this code basically in /var/www/html/noodle/noodle_ci/application/models/config_model.php:

 66         $res = $this->db->query('
 67                                 SELECT 
 68                                     id, 
 69                                     config_key, 
 70                                     config_value
 71                                 FROM
 72                                     '.$this->table.' sc
 73                                 WHERE sc.site_id = '.$this->db->escape($site_id)
 74                                 );
 75 
 76         if($res->num_rows() > 0)
 77             $configs = $res->result("array");

My guess is $res is "null". How can I rectify this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment