<?php 
class category {
	function slugExist($type,$slug,$id=0){
		if($type=='pages' && $slug!=''){
			$sql ="select * FROM tbl_pages WHERE page_slug = '".$slug."'  AND page_id != $id"; 
			return connection::execute($sql,'select');
		}		
		if($type=='news' && $slug!=''){
			$sql ="select * FROM tbl_news WHERE news_slug = '".$slug."'  AND news_id != $id"; 
			return connection::execute($sql,'select');
		}
		
		if($type=='package' && $slug!=''){
			$sql ="select * FROM tbl_package WHERE package_slug = '".$slug."'  AND package_id != $id"; 
			return connection::execute($sql,'select');
		}
	}
	function emailSubScriberAdd($data){
		
		if($data && count($data) > 0){
			$sql ="INSERT INTO `tbl_email_subscribe` (`email_address`, `status`, `created`) VALUES ('".$data->email_address."', '".$data->status."', '".$data->created."')";
			return connection::execute($sql,'insert');
		}
		return false;
	}
	
	function emailContactAdd($data){
		
		if($data && count($data) > 0){
			$sql ="INSERT INTO `tbl_email_contact` (`name`, `email_address`, `contact_no`, `subject`, `message`, `created`,`from_page`) VALUES ('".$data->name."', '".$data->email_address."', '".$data->contact_no."', '".$data->subject."', '".$data->message."', '".$data->created."', '".$data->from."');";
			return connection::execute($sql,'insert');
		}
		return false;
	}
	
	
}
?>