![]() |
new to CI, implementing relationships with the basic database library - 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: new to CI, implementing relationships with the basic database library (/showthread.php?tid=36223) |
new to CI, implementing relationships with the basic database library - El Forum - 11-25-2010 [eluser]Unknown[/eluser] Hello all, i'm new to CI, and wanted to know if it's possible to create one to one, one to many and many to many relationships with the basic database library. thanks new to CI, implementing relationships with the basic database library - El Forum - 11-25-2010 [eluser]Abdul Malik Ikhsan[/eluser] Code: //inner join ![]() new to CI, implementing relationships with the basic database library - El Forum - 11-25-2010 [eluser]Unknown[/eluser] Thanks for the reply. just to be more specific. say i have this function in my model. function GetProjectsWebsite($options = array()) { $this->db->order_by('project_display', 'asc'); if(isset ($options['limit'])) $this->db->limit($options['limit']); $query = $this->db->get("projects"); return $query->result(); } and that my projects table has a foreign key ( client_id ) to the clients table. how would i go about adding the relationship so that the result also has the client name field from the clients table. new to CI, implementing relationships with the basic database library - El Forum - 11-25-2010 [eluser]TaylorOtwell[/eluser] I believe you would need an ORM for that. CodeIgniter does not have a built-in ORM. Check out Doctrine (doctrine-project.org). new to CI, implementing relationships with the basic database library - El Forum - 11-25-2010 [eluser]WanWizard[/eluser] Or have a look at Datamapper (see my sig), a lot lighter and faster than doctrine, and especially written for CI. |