正确解读PHP应用odbc技巧
2013-09-04 21:51
417 查看
当我们在应用
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); } } ?> 以上就是PHP应用odbc的全部方法步骤,希望对大家有所帮助。
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); } } ?> 以上就是PHP应用odbc的全部方法步骤,希望对大家有所帮助。
相关文章推荐
- PHP正确解析UTF-8字符串技巧应用
- PHP正确解析UTF-8字符串技巧应用
- PHP应用技巧七则
- PHP企业级应用之常见缓存技术深入解读
- PHP 10个非常实用的高级应用技巧
- AJAX开发技术在PHP开发过程中的简单应用技巧
- 详细解读PHP弹出对话框技巧
- 技巧总结 正确使用PHP JSON扩展
- PHP 日期时间函数的高级应用技巧
- PHP日期时间函数的高级应用技巧
- 非常实用的十个PHP高级应用技巧
- 几个php应用技巧
- 深入解读PHP抽象类abstract的应用
- PHP应用JSON技巧讲解
- php开发高效的WEB系统应用技巧
- PHP日期时间函数的高级应用技巧
- 几个php应用技巧
- 详细解读PHP时区修改正确方法
- 关于JSON以及JSON在PHP中的应用技巧
- 解读PHP冒泡排序技巧