
<?
	class CONN_MYSQL
	{
		var $Host;
		var $User;
		var $Pass;
		var $DBName;
	
		function Connect()
		{
			if(!@mysql_connect($this->Host,$this->User,$this->Pass))
			{
				echo("\n<p><b span style='color:FF0000;'>ERROR : FAIL TO CONNECT</b></p>\n");
				exit();
			}
			$this->Select($this->DBName);
		}
		
		function Select($DBName)
		{
			if(!@mysql_select_db($DBName))
			{
				echo("\n<p><b span style='color:FF0000;'>ERROR : FAIL TO SELECT</b></p>\n");
				exit();
			}
		}
		
		function Execute($SqlStr) 
		{
			$TS = @mysql_query($SqlStr);
			if(!$TS)
			{
				echo("\n<p><b span style='color:FF0000;'>ERROR : FAIL TO EXECUTE</b></p>\n");
				exit();
			}
			return $TS;
		}
		
		function Fetch($TS)
		{
			$RS = @mysql_fetch_array($TS);
			if(!isset($RS))
			{
				echo("\n<p><b span style='color:FF0000;'>ERROR : FAIL TO FETCH</b></p>\n");
				exit();
			}
			return $RS;
		}
		
		function RowsNum($TS)
		{
			$RSNum = @mysql_num_rows($TS);
			if(!isset($RSNum))
			{
				echo("\n<p><b span style='color:FF0000;'>ERROR : FAIL TO COUNT</b></p>\n");
				exit();
			}
			return $RSNum;
		}
		
		function GoTo($TS,$SeekNum)
		{
			@mysql_data_seek($TS,$SeekNum);
		}
	}
	
	class CONN_ODBC
	{
		var $Host;
		var $User;
		var $Pass;
		var $DBName;
		var $Conn;

		function Connect()
		{
			$this->Conn = @odbc_connect($this->DBName,$this->User,$this->Pass);
			if(!$this->Conn)
			{
				echo("\n<p><b span style='color:FF0000;'>ERROR : FAIL TO CONNECT</b></p>\n");
				exit();
			}
		}
		
		function Execute($SqlStr) 
		{
			$TS = @odbc_exec($this->Conn,$SqlStr);
			if(!$TS)
			{
				echo("\n<p><b span style='color:FF0000;'>ERROR : FAIL TO EXECUTE</b></p>\n");
				exit();
			}
			return $TS;
		}
		
		function Fetch($TS)
		{
			$RS = @odbc_fetch_object($TS);
			if(!isset($RS))
			{
				echo("\n<p><b span style='color:FF0000;'>ERROR : FAIL TO FETCH</b></p>\n");
				exit();
			}
			return $RS;
		}
	}
?>	
