• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Joining on four tables.

#1
[eluser]noname525[/eluser]
vv

#2
[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');

#3
[eluser]noname525[/eluser]
vv

#4
[eluser]noname525[/eluser]
vv

#5
[eluser]noname525[/eluser]
vv

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

#7
[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');


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.