Models
1.Login
public function checkLogin($user,$password)
{
$this->db->select('*');
$data=$this->db->get_where('tablename',array('Email_Id'=>$user,'Password'=>md5(crc32($password)),'Status'=>'active'));
if($data->num_rows()==1)
{
return $data->result();
}
return FALSE;
}
2.Insert Data
public function insert_data($table,$data)
{
$this->db->insert($table,$data);
return 'success.';
}
3. Update Data
public function update_data($table,$data,$condition)
{
$this->db->where($condition);
$this->db->update($table,$data);
return 'success.';
}
4. Delete
public function delete_data($table,$data,$condition)
{
$this->db->where($condition);
$this->db->delete($table);
//echo $this->db->last_query();
return 'success.';
}
5. Pagination data
public function getQuotesData($table,$page_limit,$page,$condition,$order)
{
$this->db->limit($page_limit,$page);
return $this->db->select('*')->from($table)->where($condition)->order_by($order['field'],$order['type'])->get()->result();
}
6. Find in set
$this->db->where(array("FIND_IN_SET('$month_id',Month) !="=>'False','Country'=>$country_id))
$this->db->where(array("FIND_IN_SET(Airport_Code,'$Airport_Codes') !="=>0,'Status'=>'active'));
$this->db->where('mh.Hotel_Star_Rating IN('.$rating.') !=',0);
1.Login
public function checkLogin($user,$password)
{
$this->db->select('*');
$data=$this->db->get_where('tablename',array('Email_Id'=>$user,'Password'=>md5(crc32($password)),'Status'=>'active'));
if($data->num_rows()==1)
{
return $data->result();
}
return FALSE;
}
2.Insert Data
public function insert_data($table,$data)
{
$this->db->insert($table,$data);
return 'success.';
}
3. Update Data
public function update_data($table,$data,$condition)
{
$this->db->where($condition);
$this->db->update($table,$data);
return 'success.';
}
4. Delete
public function delete_data($table,$data,$condition)
{
$this->db->where($condition);
$this->db->delete($table);
//echo $this->db->last_query();
return 'success.';
}
5. Pagination data
public function getQuotesData($table,$page_limit,$page,$condition,$order)
{
$this->db->limit($page_limit,$page);
return $this->db->select('*')->from($table)->where($condition)->order_by($order['field'],$order['type'])->get()->result();
}
6. Find in set
$this->db->where(array("FIND_IN_SET('$month_id',Month) !="=>'False','Country'=>$country_id))
$this->db->where(array("FIND_IN_SET(Airport_Code,'$Airport_Codes') !="=>0,'Status'=>'active'));
$this->db->where('mh.Hotel_Star_Rating IN('.$rating.') !=',0);
No comments:
Post a Comment