Tuesday 10 February 2015

Multiple Joins in Codeigniter in PHP

Multiple Joins in Codeigniter in PHP

This code show Multiple Joins in Codeigniter.You can use this code in your projects to ease your work.

Earn Degree,PhD in counseling education


  1. $this->db->select('*');  
  2. $this->db->from('TableA AS A');// I use aliasing make joins easier  
  3. $this->db->join('TableC AS C''A.ID = C.TableAId''INNER');  
  4. $this->db->join('TableB AS B''B.ID = C.TableBId''INNER');  
  5. $result = $this->db->get();  
The join function works like this:

  1. join('TableName''ON condition''Type of join');
The equivalent SQL:

  1. $this->db->select('*');  
  2. $this->db->from('TableA AS A');// I use aliasing make joins easier  
  3. $this->db->join('TableC AS C''A.ID = C.TableAId''INNER');  
  4. $this->db->join('TableB AS B''B.ID = C.TableBId''INNER');  
  5. $result = $this->db->get();  
 

0 comments:

Post a Comment

 
Copyright © 2015. Free IT Codes | IT Projects . All Rights Reserved
Home | Company Info | Contact Us | Privacy policy | Term of use | Widget | Site map
Design by Herdiansyah . Published by Borneo Templates