<?php 

class Exam_model extends CI_Model {
	
	public function _consruct(){
		parent::_construct();
 	}
 	function addExams($examData){

 		/*$check_exam_name = $this->db->get_where('tbl_exams',array('exam_procedure'=>$examData['exam_procedure']));
 		if($check_exam_name->num_rows() > 0){
 			return false;
 		}else{*/
 			if($this->db->insert('tbl_exams',array('exam_procedure'=>ucfirst($examData['exam_procedure']),'observation'=>ucfirst($examData['observation'])))) {
 				return true;
 			}
 		//}
 	}
 	function get_all_exams(){
 		$all_exams = $this->db->get('tbl_exams');
 		if($all_exams->num_rows() > 0){
 			$result = $all_exams->result_array();
 			return $result;
 		}
 	}
 	function delete_exams($id){
 		if($this->db->delete('tbl_exams',array('id'=>$id))){
 			return true;
 		}
 	}
 	function get_single_exam($id){
 		$single_exams = $this->db->get_where('tbl_exams',array('id' => $id));
 		if($single_exams->num_rows() > 0){
 			return $single_exams->row_array();
 		}
 	}
 	function update_exam($data,$id){
 		/*$this->db->where('exam_procedure',$data['exam_procedure']);
 		$this->db->where('id !=',$id);
 		$res = $this->db->get('tbl_exams')->row();
 		if($res){
          return false;
 		}else{*/
	 		if($this->db->update('tbl_exams',array('exam_procedure'=>ucfirst($data['exam_procedure']),'observation'=>ucfirst($data['observation'])),array('id'=>$id))){
	 			return true;
	 		}
 		//}
 	}
 }