// connection to a MySQL Server
$this->ado = new CuADO;
$ado->Connect($host, $username, $password);
$ado->SelectDB($db);
// CuADO.php
class CuADO {
var $link;
var $query_handle;
function CuADO() {
}
function Connect($host, $username, $password)
{
$this->link = mysql_connect($host, $username, $password);
return $this->link;
}
function SelectDB($db)
{
return mysql_select_db($db, $this->link);
}
function sql($stmt, $debug_key = "")
{
$this->query_handle = mysql_query($stmt, $this->link) ;
return $this->query_handle;
}
function fetch_array() {
$query_handle = &$this->query_handle;
$i = 0;
while($result_rows[$i] = mysql_fetch_array( $query_handle ) ){
$i++;
}
return $result_rows;
}
}
2010年1月6日 星期三
CuADO - connection to a MySQL Server
訂閱:
張貼留言 (Atom)
CuADO 現在跟MySQL偶合在一起,不過不要緊,等到要擴充別的資料庫時,多提取一個抽像類別即可,在還未用到時,先不多做。
回覆刪除