<?php 
class Myad_Model extends Model{
	function __construct(){
		parent::__construct();
	}
	function getAds($adid=false){
		if($adid){
			$this->db->where("id",$adid);
		}
		$this->db->orderby("time","DESC");
		return $this->db->get("myad");
	}
	function addMyad($myad){
		$this->db->insert("myad",$myad);
		return $this->db->insert_id();
	}
	function updateMyad($myadid,$myad){
		return $this->db->where("id",$myadid)->update("myad",$myad);
	}
	function delete($myadid){
		$this->db->in("id",$myadid);
		return $this->db->delete("myad");
	}
}

