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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
class Profile_model extends CI_Model {
public function _consruct(){
parent::_construct();
}
public function editProfile($data,$id){
$login = $this->session->userdata('logged_in');
if($login['table'] == 'tbl_clinic'){
$newdata = array('name'=>$data['display_name'],'username'=>$data['username']);
if(isset($data['profile_picture'])){
$newdata['profile_photo'] = $data['profile_picture'];
}
}
else{
$newdata = $data;
}
$this->db->where('id',$id);
if($this->db->update($login['table'],$newdata)){
$this->db->select('*');
$this->db->from($login['table']);
$this->db->where('id',$id);
$query = $this->db->get();
if ( $query->num_rows() > 0 )
{
$row = $query->row_array();
return $row;
}
}
else{
return false;
}
}
public function checkPassword($pword,$id) {
$login = $this->session->userdata('logged_in');
$query = $this->db->get_where($login['table'],array("password"=>md5($pword),"id"=>$id));
//$query_user = $this->db->get_where("users",array("password"=>md5($pword),"id"=>$id));
if ( $query->num_rows() > 0 )
{
return true;
}
else{
return false;
}
}
function update_profileusers($data,$id){
$login = $this->session->userdata('logged_in');
$this->db->where('id', $id);
if($this->db->update($login['table'], $data)){
$this->db->select('*');
$this->db->from($login['table']);
$this->db->where('id',$id);
$query = $this->db->get();
if ( $query->num_rows() > 0 )
{
$row = $query->row_array();
return $row;
}
}
}
}