![]() |
Error when show data from database ? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Error when show data from database ? (/showthread.php?tid=32654) |
Error when show data from database ? - El Forum - 07-30-2010 [eluser]Unknown[/eluser] this my code model: Code: <?php controller: Code: <?php Error when show data from database ? - El Forum - 07-30-2010 [eluser]ELRafael[/eluser] Model Code: function get() Controller Code: $data = $this->model_name->get(); Code: $data = $this->model_name->get(); Look the result() or result_array(). You forgot that :lol: Error when show data from database ? - El Forum - 07-30-2010 [eluser]mddd[/eluser] In your model in get_data you are returning $this->db->get(); Then in your controller you are using that result ($artikels) to do 'foreach $artikels as $artikel'. But the result of get() is not a list of items. It is a database query result object. You need to get the result items from it using result() of result_array(). Change the last line of get_data(): Code: // old: |