PHP如何應用odbc技巧,很多新手對此不是很清楚,為了幫助大家解決這個難題,下面小編將為大家詳細講解,有這方面需求的人可以來學習下,希望你能有所收獲。
成都創(chuàng)新互聯(lián)專注于企業(yè)全網(wǎng)營銷推廣、網(wǎng)站重做改版、融安網(wǎng)站定制設計、自適應品牌網(wǎng)站建設、HTML5建站、商城網(wǎng)站建設、集團公司官網(wǎng)建設、成都外貿網(wǎng)站建設、高端網(wǎng)站制作、響應式網(wǎng)頁設計等建站業(yè)務,價格優(yōu)惠性價比高,為融安等各大城市提供網(wǎng)站開發(fā)制作服務。
當我們在應用PHP語言對ACCESS數(shù)據(jù)庫操作時,通常都會用到PHP中的odbc。下面我們就來具體認識一下PHP應用odbc是如何操作ACCESS數(shù)據(jù)庫的。
PHP應用odbc具體代碼:
class odbc_db
{
var $con = null;
var $resource = null;
function __construct()
{
}
function connect($dsn = ” ,
$user = ” , $passwd = ” ,
$cursor_type = 0)
{
!$dsn && $this->debug(’dsn not provided!’);
$this->con = odbc_connect($dsn ,$user
, $passwd ,$cursor_type);
!$this->con && $this->debug(’conncet failed!’);
return $this->con;
}
function query($sql = ”)
{
$this->resource = odbc_exec($this->con , $sql);
!$this->resource && $this->debug
(’query failed!’);
return $this->resource;
}
function fetch_array($resource = ”)
{
!$resource && $resource = $this->resource;
return odbc_fetch_array($resource);
}
function query_first($sql = ”)
{
$resource = $this->query($sql);
return odbc_fetch_array($resource);
}
function fetch_all($resource = ”)
{
!$resource && $resource = $this->resource;
$results = array();
while(false !== ($row = @odbc_fetch_
array($resource)))
{
$results[] = $row;
}
return $results;
}
function num_rows()
{
return odbc_num_rows($this->con);
}
function affected_rows()
{
return odbc_num_rows($this->con);
}
function debug($message = ”)
{
$message .= ‘
以下錯誤信息由ODBC 提供:’. odbc_errormsg();
exit($message);
}
function __destruct()
{
odbc_close($this->con);
}
}
?>
看完上述內容是否對您有幫助呢?如果還想對相關知識有進一步的了解或閱讀更多相關文章,請關注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝您對創(chuàng)新互聯(lián)的支持。
文章題目:PHP如何應用odbc技巧
網(wǎng)站URL:http://muchs.cn/article22/jpgejc.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供定制網(wǎng)站、響應式網(wǎng)站、商城網(wǎng)站、云服務器、網(wǎng)站設計公司、服務器托管
聲明:本網(wǎng)站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)