Database Class (v220909)

class Database
{
 	protected $handle;
 
 	/****
 	 *
 	 *  public __construct(string $host, string $username, string $password, string $database)
 	 *
	 *  @description : Establishes connection to the database.
	 *  @return : NA
	 *
 	 ****/ 	
	public function __construct($host, $username, $password, $database)
	{
	 	$mysql = @mysql_connect($host, $username, $password);
 
	 	if($mysql)
	 	{
	 	 	$this->setHandle($mysql);
 
	 	 	if(!$this->selectDatabase($database))
			{
			 	die("Database doesn't exist!" . mysql_error($this->getHandle()));
			}
	 	}
	 	else
	 	{
	 	 	die("Database connection error!" . mysql_error($this->getHandle()));
	 	}
	}
 
 	/****
 	 *
 	 *  protected selectDatabase(string $database)
 	 *
	 *  @description : Selects database.
	 *  @return : TRUE on success, FALSE on failure.
	 *
 	 ****/
 	protected function selectDatabase($database)
	{
	 	$selectDatabase = @mysql_select_db($database, $this->getHandle());
 
	 	if($selectDatabase)
		{
		 	return TRUE;
		}
		else
		{
		 	return FALSE;
		}
	}