Table Error |
[eluser]mrwilson1[/eluser]
I am getting this error when I load a page from the controller. Quote:A PHP Error was encountered My controller code is Code: function index() { My view code is Code: echo $this->table->generate($result); My model is simply Code: function get_records() The pagination works fine, but I do not understand what to do about this error. My data in the db is simple, 2 dates, a numeric field, and two text fields. Very simple stuff. Thank you in advance
[eluser]mrwilson1[/eluser]
In my model I replaced Code: return $query->result(); with Code: return $query; that seemed to do the trick, not at all sure why
[eluser]BrianDHall[/eluser]
It has to do with how you are accessing $query in your view $result() returns an Array of Objects, so in the first instance if you didn't refer to it with something like $query[0]->id then it would throw weird errors. Returning $query directly just returns a bit more simple of an object. Here's the full reference on the various return functions - have to read carefully because some are very similar, yet significantly different from each other. http://ellislab.com/codeigniter/user-gui...sults.html
[eluser]mrwilson1[/eluser]
Thanks Brian, will read further right now. Appreciate you |
Welcome Guest, Not a member yet? Register Sign In |