class User_model extends CI_Model
{
function __construct()
{
parent::__construct();
$this->load->database();
}
function insertrow($data,$table){
$this->db->insert($table,$data);
}
function updaterow($data,$table,$id){
$this->db->where($id);
$this->db->update($table,$data);
}
function fetchrow($table){
$query = $this->db->get($table);
return $query->result();
}
function fetchrowedit($tbl_name,$id){
$query = $this->db->get_where($tbl_name, $id);
return $query->result();
}
function fetchrowlogin($info,$table){
$this->db->select('*');
$this->db->where($info);
$this->db->from($table);
$query = $this->db->get();
if($query->num_rows() > 0){
$row = $query->row_array();
return $row;
}
}
function alreadyexits($table,$var){
$query = $this->db
->select('*')
->where($var)
->get($table)
->num_rows();
return $query;
}
function isVarExists($table,$var){
$query = $this->db
->select('*')
->where($var)
->get($table)
->num_rows();
return $query;
}
function messages_list($ids){
$this->db->where('reciver_id', $ids);
$this->db->limit(10);
$this->db->order_by("time", "asc");
$this->db->from('message_table');
$query = $this->db->get();
return $query->result();
}
}