Fatal error: Class ” not found in CodeIgniter
Screen Got stuck eventually with this error during CodeIgniter development.
Fatal error: Class '' not found in C:\Server\xampp56\htdocs\alf\classified\system\database\drivers\mysqli\mysqli_result.php on line 183
A PHP Error was encountered Severity: Error Message: Class '' not found Filename: mysqli/mysqli_result.php Line Number: 183 Backtrace:
How to Solve this error:
Make sure you are not passing empty string to ->result();
method
public function getAll($type=''){
return $this->db->get("$this->table")->result($type);
}
In the above code $type parameter is optional but when you leave it like this it send and empty thing to codeIgniter database class which is NOT handled by core framework. It seems a bug in codeIgniter.
So always use your database functions like this:
$this->db->get("table_name")->result(); // leave it empty for objects;
$this->db->get("table_name")->result("array"); // for array of rows;
I am not sure if this helps someone else, but it fixed my problem as core searches for a class based on parameter passed in ->result()
method.
Permanent Solution:
Leave a Reply