<?php
class SMSType{

	private $conn;
	private $table_name = "sms_type";

	public $id;	
	public $sms_type;
	public $city;
	public $entry_by;
	public $entry_date_time;

	public function __construct($db){
		$this->conn = $db;
	}

	function create(){
		$query = "UPDATE " . $this->table_name . " SET sms_type=:sms_type, city=:city, entry_by=:entry_by, entry_date_time=:entry_date_time";
		$stmt = $this->conn->prepare($query);

		$stmt->bindParam(":sms_type", $this->sms_type);
		$stmt->bindParam(":city", $this->city);
		$stmt->bindParam(":entry_by", $this->entry_by); 
		$stmt->bindParam(":entry_date_time", $this->entry_date_time);

		if($stmt->execute()){
			return true;
		}	 
		return false;
	}

	function getSMSType(){
		$query = "SELECT * FROM " . $this->table_name . " group by sms_type";
		$stmt = $this->conn->prepare( $query );
		$stmt->execute();
		if($stmt->rowCount()>0){
			$row = $stmt->fetch(PDO::FETCH_ASSOC);
			$this->sms_type1 = $row['sms_type'];
			$this->city1 = $row['city'];
		}
	}

}
?>
