Join 2 or more Table in CodeIgniter

CodeIgniter PHP Framework is one that is very popular today, because it provides the framework needs a simple standard data processing. Associated with ease, we also facilitated when we’ll do join two or more tables.

In this case I will join explaining the use of join in Active Record provided by CodeIgniter. CodeIgniter join type used is the type of join ON. We assume there are 3 pieces table named paket_pekerjaan, areas and periods. This coding is below.

function selectAll(){
return $this->db->get('paket_pekerjaan')->result();

If we use Active Record, so this query is below

select p.Kode_Pkt_Pekerjaan, p.Nama_Pkt_Pkrjaan, p.Nilai,b.nama_bidang, q.Nama_Periode
FROM paket_pekerjaan p
JOIN bidang b
ON(p.id_bidang = b.id_bidang)
JOIN periode q
ON(p.id_periode = q.id_periode)

That’s about join 2 or more tables in CodeIgniter Framework. If what I wrote above coding error or wrong please send comments via the comments box below. Thank you and good luck  :2thumbup


Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:


You are commenting using your account. Logout /  Ubah )

Foto Google+

You are commenting using your Google+ account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )


Connecting to %s

%d blogger menyukai ini: