<?php 

class memo{

	function add_memo($arr)
		{
				if (count($arr) > 0) 
				{					
					$sql = sprintf("insert into memo_event 
									(start_date, end_date, event_title, shared_user_id, location, description, user_id)
									values ('%s', '%s', '%s', '%s', '%s', '%s', '%s')",
									$arr[0], $arr[1], $arr[2], $arr[3], $arr[4], $arr[5], $arr[6]);
					
					if (mysql_query($sql))
					{	
						return true;					
					
					}else{
						
						return "Error: " . mysql_error();
					}
				
				}else{
					return "Error: Please enter the required field values.";
				}
		}

	function get_memo_information($memo_id)
	{
		$memo_id = ($memo_id != '') ? $memo_id : 0;
		
		$sql = sprintf("select * from memo_event where memo_event_id = '%s'", $memo_id);
		$res = mysql_query($sql);
		
		return mysql_fetch_array($res);
	}
	
	
	function update_memo($arr)
	{
		if (count($arr) > 0) 
		{

		///////////////////////////////////////	inserting query //////////////////////////////////////
		
		$sql = sprintf("UPDATE `memo_event` SET `start_date` = '%s', `end_date` = '%s', `event_title` = '%s', `shared_user_id` = '%s', `location` = '%s', `description` = '%s' WHERE `memo_event_id` = '%s'", $arr[0], $arr[1], $arr[2], $arr[3], $arr[4], $arr[5], $arr[6]);
		
			if (mysql_query($sql))
				return true;
			else
				return "Error: " . mysql_error();
		}
		else
		{
			return "Error: Please enter the required field values.";
		}
	}

}

?>