<?php
/**** Class Database ****/
Class MyDatabase
{
/**** function connect to database ****/
function MyDatabase($strHost,$strDB,$strUser,$strPassword)
{
$this->objConnect = mysql_connect($strHost,$strUser,$strPassword);
mysql_query("SET NAMES TIS620");
$this->DB = mysql_select_db($strDB);
}
/**** function select record ****/
function fncSelectRecordAll()
{
$strSQL = "SELECT * FROM $this->strTable ";
$objQuery = @mysql_query($strSQL);
return @mysql_fetch_array($objQuery);
}
/*** end class auto disconnect ***/ รบกวนอธิบายสามบรรทัดนี้ด้วยนะคะไม่เข้าใจจริงๆ
function __destruct() {
return @mysql_close($this->objConnect);
}
}
?>