<?php
class Dbsetting extends CI_Model {
function Dbsetting()
{
// Call the Model constructor
parent::__construct();
$this->load->database();
}
public function insert($tablename,$data)
{
if($this->db->insert($tablename,$data))
{
return true;
}
else
{
return false;
}
return true;
}
function getInfo_($query,$return='')
{
$query=$this->db->query($query);
if($return=='')
{
return $query->row();
}
else
{
return $query->result();
}
}
function delete($table_name,$array)
{
foreach($array as $key=>$value)
{
$this->db->where($key,$value);
}
$this->db->delete($table_name);
return true;
}
public function update($table_name,$array,$data)
{
foreach($array as $key=>$value)
{
$this->db->where($key,$value);
}
if($this->db->update($table_name, $data))
{
return true;
}
else
{
return false;
}
}
/*public function update_all($table_name,$data)
{
foreach($array as $key=>$value)
{
$this->db->where($key,$value);
}
if($this->db->update($table_name, $data))
{
return true;
}
else
{
return false;
}
}*/
public function check_if_oldpassword_exists($old_password)
{
$this->db->where('password',$old_password);
$result=$this->db->get('bpo_admin_login');
if($result->num_rows()>0)
{
return FALSE;
}
else
{
return TRUE;
}
}
public function check_if_username_exists($username)
{
$this->db->where('user_name',$username);
$result=$this->db->get('user');
if($result->num_rows()>0)
{
return FALSE; //usrername taken
}
else
{
return TRUE; // Username can be reg'd
}
}
public function check_if_email_exists($email)
{
$this->db->where('email',$email);
$result=$this->db->get('bpo_clients');
if($result->num_rows()>0)
{
return FALSE; // email id taken
}
else
{
return TRUE; // email can be reg'd
}
}
public function check_if_email_exists_forgetpass($email,$table)
{
$this->db->where('email',$email);
$result=$this->db->get($table);
if($result->num_rows()>0)
{
return TRUE; // email id taken
}
else
{
return FALSE; // email can be reg'd
}
}
}
?>
Comments
Post a Comment