![]() |
Trying to get property of non-object - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Trying to get property of non-object (/showthread.php?tid=69875) |
Trying to get property of non-object - florent6001 - 01-25-2018 Hi all, I want to make a table with the members list of my website, but i have Trying to get property of non-object as error. Here is my controller: Code: public function memberslist(){ Here is my model: Code: public function memberslist(){ RE: Trying to get property of non-object - dave friend - 01-25-2018 You can pass a database result object directly to table->generate(). It saves you all the trouble of looping through result_array(). The model becomes PHP Code: /** The controller will work as you have it. RE: Trying to get property of non-object - florent6001 - 01-25-2018 (01-25-2018, 11:00 AM)dave friend Wrote: You can pass a database result object directly to table->generate(). It saves you all the trouble of looping through result_array(). CI_DB_mysqli_result as array i have this error now RE: Trying to get property of non-object - florent6001 - 01-25-2018 I found a solution: My model: PHP Code: public function memberslist(){ My controller: PHP Code: $template = array( RE: Trying to get property of non-object - dave friend - 01-25-2018 I see where my advice went bad. In the controller (your original post) the line PHP Code: $tableau = array($this->admin_model->memberslist()); should be changed to PHP Code: $tableau = $this->admin_model->memberslist(); |