![]() |
Quick question! Multiple tables - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Quick question! Multiple tables (/showthread.php?tid=24013) |
Quick question! Multiple tables - El Forum - 10-28-2009 [eluser]Paleleaves[/eluser] Hi, I've a model. Pls see the code below Code: <?php It's working fine but I need pass multiple tables in the place of 'property' in my model. see the code below. Code: SELECT * FROM property, district, ptype WHERE property.reqType = ptype.pID AND property.districtName = district.dID Anybody can help me to modify my model using this query. thanks Quick question! Multiple tables - El Forum - 10-28-2009 [eluser]thdls55[/eluser] Hi, you need to use: Code: $this->db->join(); as shown here. Quick question! Multiple tables - El Forum - 10-30-2009 [eluser]Paleleaves[/eluser] Hi, thanks for the help. But it didn't work at all. I've changed the <Model> like below. Code: <?php I spent many hours to correct this issue and tried different methods! :red: Quick question! Multiple tables - El Forum - 10-30-2009 [eluser]kikz4life[/eluser] what thdls55 saying is you must use join statement to select data from different tables. Code: $this->db->join('tablename1 a', 'a.fieldname1=tablename2.fieldname', 'left') |