CodeIgniter Forums
Joining on four tables. - 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: Joining on four tables. (/showthread.php?tid=50316)



Joining on four tables. - El Forum - 03-22-2012

[eluser]noname525[/eluser]
vv


Joining on four tables. - El Forum - 03-22-2012

[eluser]Matalina[/eluser]
Join statements work:

Code:
$this->db->join('Country','Register.country_id = Country.country_id');
$this->db->join('State','Register.state_id = State.state_id');
$this->db->join('City','Register.city_id = City.city_id');
$query = $this->db->get('Register');



Joining on four tables. - El Forum - 03-23-2012

[eluser]noname525[/eluser]
vv


Joining on four tables. - El Forum - 03-23-2012

[eluser]noname525[/eluser]
vv


Joining on four tables. - El Forum - 03-23-2012

[eluser]noname525[/eluser]
vv


Joining on four tables. - El Forum - 03-24-2012

[eluser]Unknown[/eluser]
If you only wanna make selects on that query, why not use a view created in MySQL?


Joining on four tables. - El Forum - 03-26-2012

[eluser]Matalina[/eluser]
select statements are a string not an array. So you have to take out all those extra quotes and commas

Code:
$this->db->select('country.name AS cname, state.name AS sname, city.name AS ccname, register.id AS rid, register.name AS rname, register.email AS remail');