<?php
/**
	by it308.com
*/
class EmailGroup_m extends CI_Model{
	public function __construct(){
		parent::__construct();
	}
	public function insert($data){
		$this->db->insert('emailgroup',$data);
		return $this->db->affected_rows();
	}
	public function get($where){
		$this->db->where($where);
		$res = $this->db->get('emailgroup')->result();
		//echo $this->db->last_query();
		return $res;
	}
	public function getInner($where){
		$this->db->select('groups.name as gname');
		$this->db->join('groups', 'groups.id = emailgroup.gid', 'left');
		$this->db->where($where);
		$res = $this->db->get('emailgroup')->result();
		return $res;
	}
	public function delete($where){
		$this->db->where($where);
		$this->db->delete('emailgroup');
		return $this->db->affected_rows();
	}
}