![]() |
Using methods on objects - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Using methods on objects (/showthread.php?tid=22343) |
Using methods on objects - El Forum - 09-05-2009 [eluser]bapobap[/eluser] Would someone kindly explain how the following works as I'm not sure what is going on code wise. So for this: Code: $user = $this->db->limit(1)->get('users'); It returns: Code: CI_DB_mysql_result Object from there you can do things like: Code: $user->row(); or $user->result(); What is actually happening here? I'm more used to having a user model where I get the user object, then pass it back into methods, so: Code: $user = $this->user_model->user('username'); whereas something like: Code: $user = $this->user_model->user('username'); is much handier. Though I may be misunderstanding how all this is working. |