新聞中心
當(dāng)我們?cè)趹?yīng)用PHP語(yǔ)言對(duì)ACCESS數(shù)據(jù)庫(kù)操作時(shí),通常都會(huì)用到PHP中的odbc。下面我們就來(lái)具體認(rèn)識(shí)一下PHP應(yīng)用odbc是如何操作ACCESS數(shù)據(jù)庫(kù)的。#t#

為靜樂(lè)等地區(qū)用戶(hù)提供了全套網(wǎng)頁(yè)設(shè)計(jì)制作服務(wù),及靜樂(lè)網(wǎng)站建設(shè)行業(yè)解決方案。主營(yíng)業(yè)務(wù)為成都做網(wǎng)站、成都網(wǎng)站制作、靜樂(lè)網(wǎng)站設(shè)計(jì),以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專(zhuān)業(yè)、用心的態(tài)度為用戶(hù)提供真誠(chéng)的服務(wù)。我們深信只要達(dá)到每一位用戶(hù)的要求,就會(huì)得到認(rèn)可,從而選擇與我們長(zhǎng)期合作。這樣,我們也可以走得更遠(yuǎn)!
PHP應(yīng)用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 .= ‘
- 以下錯(cuò)誤信息由ODBC 提供:’. odbc_errormsg();
- exit($message);
- }
- function __destruct()
- {
- odbc_close($this->con);
- }
- }
- ?>
以上就是PHP應(yīng)用odbc的全部方法步驟,希望對(duì)大家有所幫助。
當(dāng)前名稱(chēng):正確解讀PHP應(yīng)用odbc技巧
網(wǎng)頁(yè)地址:http://www.dlmjj.cn/article/cossiph.html


咨詢(xún)
建站咨詢(xún)
