Monday 22 August 2016

How to JOIN Tables in Codeigniter

I am gonna use CodeIgniter’s active record class to generate Join Queries in this tutorial. Because by using AR class we can write complex joins very easily and a major benefit to using the Active Record features is that it allows you to create database independent applications, since the query syntax is generated by each database adapter. It also allows for safer queries, since the values are escaped automatically by the system.

Codeigniter JOIN Query

we use join() method to join the 2 or more tables in codeigniter.

Normal Join

Join With Condition

Join with multiple tables

You need to call join() method multiple times if you need several joins in one query.
If you need a specific type of JOIN you can specify it via the third parameter of the function. Options are: left, right, outer, inner, left outer, and right outer.

Join with specific type (left, right, outer, inner, left outer, and right outer)

You need to call join() method multiple times if you need several joins in one query.
Do share it and let your friend’s know about it.

No comments:

Post a Comment

Installation of Drop Box API on Codigniter

As with the YouTube API the first step in getting this sucker setup is getting a developer key by visiting  https://www.dropbox.com/develop...