CodeIgniter Forums
Multiple table relationanal query - 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: Multiple table relationanal query (/showthread.php?tid=37992)



Multiple table relationanal query - El Forum - 01-27-2011

[eluser]Unknown[/eluser]
Hello,
I'm very new to CI. I've been looking around for a multiple associated table example online and I cant find one. So my question is if I have two tables like so:
Code:
---------                    ------------
| USERS |                    | COMMENTS |
| ----- |                    | -------- |
| Id    |-------------------<| Users_Id |
| Name  |                    | Text     |
| Last  |                    ------------
---------
and we have a one to many relationship, where a user can have multiple comments.
whats the statement I have to use to get all the comments of a user given a name?

I'm a CakePHP guy, and I like the loosens of CI that's why I'm exploring CI and I like it so far.


Multiple table relationanal query - El Forum - 01-27-2011

[eluser]Future Webs[/eluser]
check the user guide for the database class and the join function

Code:
$this->db->join