偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

正確解讀PHP應用odbc技巧

開發(fā) 后端
PHP應用odbc樂意幫助我們進行ACESS數(shù)據(jù)庫的操作。對于新手來說對于這一操作步驟應該還不是太清楚。希望通過本文介紹的知識能夠充分掌握這一技巧。

當我們在應用PHP語言對ACCESS數(shù)據(jù)庫操作時,通常都會用到PHP中的odbc。下面我們就來具體認識一下PHP應用odbc是如何操作ACCESS數(shù)據(jù)庫的。#t#

PHP應用odbc具體代碼:

  1. class odbc_db  
  2. {  
  3. var $con = null;  
  4. var $resource = null;  
  5. function __construct()  
  6. {  
  7. }  
  8. function connect($dsn = ” , 
    $
    user = ” , $passwd = ” , 
    $
    cursor_type = 0)  
  9. {  
  10. !$dsn && $this->debug(’dsn not provided!’);  
  11. $this->con = odbc_connect($dsn ,$user 
    , $passwd ,$cursor_type);  
  12. !$this->con && $this->debug(’conncet failed!’);  
  13. return $this->con;  
  14. }  
  15. function query($sql = ”)  
  16. {  
  17. $this->resource = odbc_exec($this->con , $sql);  
  18. !$this->resource && $this->debug
    (’query failed!’);  
  19. return $this->resource;  
  20. }  
  21. function fetch_array($resource = ”)  
  22. {  
  23. !$resource && $resource = $this->resource;  
  24. return odbc_fetch_array($resource);  
  25. }  
  26. function query_first($sql = ”)  
  27. {  
  28. $resource = $this->query($sql);  
  29. return odbc_fetch_array($resource);  
  30. }  
  31. function fetch_all($resource = ”)  
  32. {  
  33. !$resource && $resource = $this->resource;  
  34. $results = array();  
  35. while(false !== ($row = @odbc_fetch_
    array($resource)))  
  36. {  
  37. $results[] = $row;  
  38. }  
  39. return $results;  
  40. }  
  41. function num_rows()  
  42. {  
  43. return odbc_num_rows($this->con);  
  44. }  
  45. function affected_rows()  
  46. {  
  47. return odbc_num_rows($this->con);  
  48. }  
  49. function debug($message = ”)  
  50. {  
  51. $message .= ‘  
  52. 以下錯誤信息由ODBC 提供:’. odbc_errormsg();  
  53. exit($message);  
  54. }  
  55. function __destruct()  
  56. {  
  57. odbc_close($this->con);  
  58. }  
  59. }  
  60. ?> 

以上就是PHP應用odbc的全部方法步驟,希望對大家有所幫助。

責任編輯:曹凱 來源: realized.cn
相關推薦

2009-12-11 16:44:33

PHP冒泡排序

2009-12-07 18:57:17

PHP讀取Cookie

2009-12-09 14:25:21

PHP獲取時間錯誤

2009-12-10 17:54:57

PHP刪除Cookie

2009-12-08 14:11:03

PHP時區(qū)修改

2009-12-04 14:09:52

PHP JSON應用

2009-12-04 15:43:03

PHP JSON擴展

2009-12-10 09:48:26

PHP獲取遠程圖片

2009-12-07 14:38:14

PHP foreach

2009-12-11 15:35:50

PHP彈出對話框

2009-12-11 17:57:13

PHP應用JSON

2009-12-08 16:48:25

PHP類phpExce

2009-11-26 09:06:35

PHP遞歸數(shù)組

2009-12-11 10:59:48

PHP函數(shù)extrac

2010-03-03 17:33:52

Python讀取XML

2009-11-17 11:24:00

PHP應用技巧

2009-11-18 18:24:26

PHP模板

2009-12-08 09:51:10

PHP intval函

2010-02-26 10:46:12

WCF行為擴展

2010-03-01 16:04:31

WCF服務契約
點贊
收藏

51CTO技術棧公眾號