<?php 
if (!defined('BASEPATH')) exit('No direct script access allowed');
class basic_query_m extends CI_Model {

	function cari($nomor_perkara){
		try{
			$sql = "select nomor_perkara from perkara WHERE alur_perkara_id < 111 and nomor_perkara like '".$nomor_perkara."%' ORDER BY split_string(nomor_perkara,'/',3) DESC, split_string(nomor_perkara,'/',2) DESC, split_string(nomor_perkara,'/',1) DESC";
			$query = $this->db->query($sql);
			return $query;
		}catch(Exception $e){
		}
	}

	function get($table='',$params=array(), $select=array(), $order_by=array()){
		if(!empty($select)){
			foreach ($select as $key => $value) {
				$this->db->select($value);	
			}
		}

		foreach ($params as $key => $value) {
            $this->db->where($key, $value);
		}

		foreach ($order_by as $key => $value) {
			$this->db->order_by($key, $value);
		}

        return $this->db->get($table);
	}

	function get_query($query=null){
		if(isset($query)){
			return $this->db->query($query);
		}
	}
}
?>