PHP アプリケーション odbc スキルの正しい解釈_PHP チュートリアル

WBOY
リリース: 2016-07-15 13:33:57
オリジナル
870 人が閲覧しました

PHP アプリケーション odbc 固有のコードを適用する場合:

  1. class odbc_db
  2. {
  3. var $con = null ;  
  4. var $リソース = null;  
  5. function __construct()
  6. {
  7. }
  8. function connect($dsn = ” ,
    $
    ユーザー = ” , $ passwd = ” ,
    $
    cursor_type = 0)
  9. {
  10. !$dsn && $this-> debug('DSN が提供されていません!');  
  11. $this->con = odbc_connect($dsn ,$user
    wd、$cursor_type);  
  12. !$this->con && $this->debug(’conncet failed!’);  
  13. return $this->con;  
  14. }
  15. 関数クエリ($sql = ”)
  16. {
  17. $this- >リソース = odbc_exec($this->con , $sql);  
  18. !$this->リソース&&$this->デバッグ
    (「クエリは失敗しました!」);  
  19. return $this->リソース;  
  20. }
  21. function fetch_array($resource = ”)
  22. {
  23. !$resource & & $
  24. リソース = $this- >リソース;  
  25. return odbc_fetch_array($resource);  
  26. }
  27. function query_first($
  28. sql = ”)
  29. {
  30. $
  31. リソース = $this-> クエリ($sql);  
  32. return odbc_fetch_array($resource);  
  33. }
  34. function fetch_all($
  35. resource = ”)
  36. {
  37. !$resource && $
  38. リソース = $this- >リソース;  
  39. $
  40. 結果 = array();  
  41. while(false !== ($
  42. row = @odbc_fetch_ array($resource)))
  43. {
  44. $results[] = $行;  
  45. }
  46. $results を返す;  
  47. }
  48. function num_rows()
  49. {
  50. return odbc_num_rows($this-
  51. >) コン);  
  52. }
  53. function affected_rows()
  54. {
  55. return odbc_num_rows($this-
  56. > コン);  
  57. }
  58. 関数 デバッグ($
  59. メッセージ = ”)
  60. {
  61. $メッセージ
  62. .= '
  63. 以下错误情報ODBC によって提供される:'。 odbc_errormsg();  
  64. 終了($message);  
  65. }
  66. function __destruct()
  67. {
  68. odbc_close($this-
  69. > コン);  
  70. }
  71. }
  72. ?>
  73. 以上はPHP应用odbcのすべてのメソッド步どうぞ、大家様にお役に立てれば幸いです。


http://www.bkjia.com/PHPjc/446028.html

www.bkjia.com

http://www.bkjia.com/PHPjc/446028.html技術記事現在私は PHP 用 odbc の特定のコード: classodbc_db { var$ con = null ; var$ リソース = null ; function__construct() { } functionconnect($ dsn =, $ user =,$ passwd =, $ cu...
ソース:php.cn
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
最新の問題
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!