<?php
/**
	by it308.com
*/
class Groups_m extends CI_Model{
	public function __construct(){
		parent::__construct();
	}
	public function insert($data){
		$this->db->insert('groups',$data);
		return $this->db->affected_rows();
	}
	public function update($where,$data){
		$this->db->where($where);
		$this->db->update('groups',$data);
		return $this->db->affected_rows();
	}
	public function delete($where){
		$this->db->where($where);
		$this->db->delete('groups');
		return $this->db->affected_rows();
	}
	public function get($where="",$value="",$uid=0){
		$this->db->where($where,$value);
		$this->db->where('uid',$uid);
		return $this->db->get('groups')->result();
	}
	public function getNew($where){
		$this->db->where($where);
		return $this->db->get('groups')->result();
	}
	public function  getWhere($where){
		$this->db->where($where);
		$this->db->order_by('time desc');
		return $this->db->get('groups')->result();
	}
	public function getID($where){
		$this->db->where($where);
		$res = $this->db->get('groups')->result();
		return $res;
	}
	public function getLimit($where="",$value="",$begin=0,$count=0,$uid=0){
		$this->db->where($where,$value);
		$this->db->where('uid',$uid);
		$this->db->order_by('time desc');
		$this->db->limit($count,$begin);
		return  $this->db->get('groups')->result();
	}
}