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

/**
* MODEL FOR REQUEST
* @author : Zul Zolkaffly
* @last-update : Zul Zolkaffly (10/08/2016)
*/
class apply_main extends CI_Model {

	public function getAll() {
		//$this->db->order_by('companyName', 'Asc');
		$query = $this->db->get('apply_main');
		
		return ($query && $query->num_rows() >= 1) ? $query->result() : NULL;
	}

	public function getMain($id) {
		$this->db->where('companyID', $id);
		$query = $this->db->get('apply_main');
		
		if ($query && $query->num_rows() >= 1) {
			$rs = $query->result();
			return ($rs[0]) ? $rs[0] : NULL;
		} else {
			return NULL;
		}
	}

	public function updateMain($id, $data) {
		$this->db->where('companyID', $id);
		$query = $this->db->update('apply_main', $data);
		
		return ($query === TRUE) ? TRUE : FALSE;
	}
	

}
