<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class help_m extends CI_Model {

	function getVersion(){
		try {
			$query = $this->db->query("SELECT id,patch_ver from updates group by patch_ver ORDER BY id"); 
			return $query;
		} catch (Exception $e) {
			log_message('error', $e);
		}
	}

	function getReleaseNote($update_id=NULL){
		if(!empty($update_id) || $update_id!='' AND $update_id!=NULL){
			$where = ' WHERE uc.update_id ='.$update_id;
		}else{
			$where =" ";
		}
		try {
			$query = $this->db->query("SELECT u.patch_ver,uc.* 
									   FROM updates_catatan uc
									   LEFT JOIN updates u on uc.update_id= u.id ".$where." ORDER BY uc.id"); 
			return $query;
		} catch (Exception $e) {
			log_message('error', $e);
		}
	}

}