1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?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'=>encrypt_data(ucfirst($examData['exam_procedure'])),'observation'=>encrypt_data(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'=>encrypt_data(ucfirst($data['exam_procedure'])),'observation'=>encrypt_data(ucfirst($data['observation']))),array('id'=>$id))){
return true;
}
//}
}
}