Codeigniter - Call to a member function result_array() on boolean - Local setup Installation error

Sum :

I require help in codeigniter as a learner. I am trying to do a local setup but its giving the following error.

Fatal error: Call to a member function result_array() on boolean in xampp\htdocs\test\application\models\Homemodel.php on line 1144

return $result = $this->db->get()->result_array();

Thank you for help. Stay blessed!!

Aksen P :

Try to replace:

return $result = $this->db->get()->result_array();

with

return $this->db->get() ? $this->db->get()->result_array() : [];

It names ternary operator, works similar to if statement:

if ($this->db->get()) {} else {}

This error occurs cause of $this->db->get() returns a boolean value (true/false)

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=383504&siteId=1