Last active
April 18, 2016 04:18
-
-
Save virbo/c713bbfb7d5c78c1c04c367301f3e0dd to your computer and use it in GitHub Desktop.
models/Alumni_models.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php defined('BASEPATH') OR exit('No direct script access allowed'); | |
class Alumni_model extends CI_Model | |
{ | |
/** | |
* @author Yusuf Ayuba | |
* @since 2016 | |
*/ | |
public function __construct() | |
{ | |
parent::__construct(); | |
} | |
public function create($data) | |
{ | |
return $this->db->insert('modul_alumni',$data); | |
} | |
public function get_wil_ajax($cari,$limit) | |
{ | |
$this->db->select('rp.id AS id_prop,rk.id AS id_kab,rc.id AS id_kec,rd.id AS id_desa, | |
rp.name AS prop,rk.name AS kab,rc.name AS kec, | |
rd.name AS desa') | |
->from('provinces AS rp') | |
->join('regencies AS rk','rk.province_id=rp.id') | |
->join('districts AS rc','rc.regency_id=rk.id') | |
->join('villages AS rd','rd.district_id=rc.id') | |
->like('rd.name',$cari) | |
->order_by('rp.name','ASC') | |
->limit($limit,0); | |
return $this->db->get(); | |
} | |
public function get_location() | |
{ | |
$this->db->select('al.nm_alumni,al.id_wil,rd.name AS desa, | |
rk.name AS kec, rb.name AS kab, | |
rp.name AS prop') | |
->from('modul_alumni'.' AS al') | |
->join('villages AS rd','al.id_wil=rd.id') | |
->join('districts AS rk','rd.district_id=rk.id') | |
->join('regencies AS rb','rk.regency_id=rb.id') | |
->join('provinces AS rp','rb.province_id=rp.id'); | |
return $this->db->get(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment