久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      1. <legend id='KJqlw'><style id='KJqlw'><dir id='KJqlw'><q id='KJqlw'></q></dir></style></legend>

          <bdo id='KJqlw'></bdo><ul id='KJqlw'></ul>

      2. <small id='KJqlw'></small><noframes id='KJqlw'>

        <i id='KJqlw'><tr id='KJqlw'><dt id='KJqlw'><q id='KJqlw'><span id='KJqlw'><b id='KJqlw'><form id='KJqlw'><ins id='KJqlw'></ins><ul id='KJqlw'></ul><sub id='KJqlw'></sub></form><legend id='KJqlw'></legend><bdo id='KJqlw'><pre id='KJqlw'><center id='KJqlw'></center></pre></bdo></b><th id='KJqlw'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='KJqlw'><tfoot id='KJqlw'></tfoot><dl id='KJqlw'><fieldset id='KJqlw'></fieldset></dl></div>
      3. <tfoot id='KJqlw'></tfoot>

        致命錯誤:在非對象上調用成員函數 fetchALL() - 在

        Fatal error: Call to a member function fetchALL() on a non-object - using PDO on a Microsoft Access Database(致命錯誤:在非對象上調用成員函數 fetchALL() - 在 Microsoft Access 數據庫上使用 PDO) - IT屋-程序員軟件開發

      4. <legend id='NVDbe'><style id='NVDbe'><dir id='NVDbe'><q id='NVDbe'></q></dir></style></legend>
      5. <tfoot id='NVDbe'></tfoot>

          <bdo id='NVDbe'></bdo><ul id='NVDbe'></ul>
              <tbody id='NVDbe'></tbody>

            <small id='NVDbe'></small><noframes id='NVDbe'>

          • <i id='NVDbe'><tr id='NVDbe'><dt id='NVDbe'><q id='NVDbe'><span id='NVDbe'><b id='NVDbe'><form id='NVDbe'><ins id='NVDbe'></ins><ul id='NVDbe'></ul><sub id='NVDbe'></sub></form><legend id='NVDbe'></legend><bdo id='NVDbe'><pre id='NVDbe'><center id='NVDbe'></center></pre></bdo></b><th id='NVDbe'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='NVDbe'><tfoot id='NVDbe'></tfoot><dl id='NVDbe'><fieldset id='NVDbe'></fieldset></dl></div>

                  本文介紹了致命錯誤:在非對象上調用成員函數 fetchALL() - 在 Microsoft Access 數據庫上使用 PDO的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  下午好!

                  我已經建立了一個到 Microsoft Access 數據庫(有效)的連接類.然而,我的問題在于我試圖使用這個類來執行一個簡單的 SQL 語句,但我收到錯誤消息:致命錯誤:調用非對象上的成員函數 fetchALL().

                  I have made a connection class to a Microsoft Access Database (which works). However my problem lies where I'm trying to use this class to execute a simple SQL statement and I receive the error message: Fatal error: Call to a member function fetchALL() on a non-object.

                  我對 PDO 還很陌生,在網上閱讀了很多文章,但都無濟于事.我想我理解我的問題,但并不完全理解,請有人能解釋一下這種情況,并可能就我收到錯誤消息的原因提供答案嗎?

                  I'm fairly new to PDO and have read a lot of articles online but to no avail. I think I understand my problem but not fully, please could someone shed some light on the situation and possibly provide an answer to why i'm getting the error message?

                  connectionClass.php

                  connectionClass.php

                  class connection{
                  
                        public $con;
                        private $dbName;
                  
                        function __construct(){
                            $this->dbName = $_SERVER["DOCUMENT_ROOT"] . "databaseyakety1new.mdb";
                         }
                  
                        function connect(){
                            $this->con = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$this->dbName; Uid=Admin; Pwd=;");
                            $this->con->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
                            return $this->con;
                           }   
                        }
                  
                        if (!ini_get('display_errors')) {
                        ini_set('display_errors', '1');
                        }
                  

                  testIndex.php

                  testIndex.php

                  try{
                     include_once 'classesconnectionClass.php';
                  
                  
                     $con = new connection();
                     $pdoConnection = $con->connect();
                  
                  
                     $sql = $pdoConnection->prepare("SELECT * FROM celebs");
                     $result = $pdoConnection->exec($sql);
                       while ($row = $result->fetchALL(PDO::FETCH_ASSOC)) {
                         echo $row['firstname'];
                         echo $row['surname'];
                        }
                     } catch (Exception $e){
                         echo 'ERROR:'.$e->getMessage();
                         file_put_contents('connection.errors.txt', $e->getMessage().PHP_EOL,FILE_APPEND);
                         }
                  
                         if (!ini_get('display_errors')) {
                         ini_set('display_errors', '1');
                        }
                  

                  錯誤信息與這一行有關:

                  The error message is related to this line:

                  while ($row = $result->fetchALL(PDO::FETCH_ASSOC)) {
                  

                  非常感謝任何幫助,謝謝!

                  Any help is greatly appreciated, thanks!

                  推薦答案

                  $result 只是一個布爾值,表示查詢是否成功.fetchAll 方法在 PDOStatement 上,所以它應該是:

                  $result is just a boolean that indicates whether the query was successful or not. The fetchAll method is on PDOStatement, so it should be:

                  while ($row = $sql->fetch(PDO::FETCH_ASSOC)) {
                  

                  您也執行錯誤的語句,應該是:

                  You're also executing the statement wrong, it should be:

                  $result = $sql->execute();
                  

                  您使用的方法是在不事先準備的情況下執行 SQL 字符串.你可以這樣做:

                  The method you used is for executing a SQL string without first preparing it. You could instead do:

                  $result = $pdoConnection->exec("SELECT * FROM celebs");
                  while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
                  

                  這篇關于致命錯誤:在非對象上調用成員函數 fetchALL() - 在 Microsoft Access 數據庫上使用 PDO的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)
                  <legend id='Z7UJP'><style id='Z7UJP'><dir id='Z7UJP'><q id='Z7UJP'></q></dir></style></legend>
                  <tfoot id='Z7UJP'></tfoot>
                        <tbody id='Z7UJP'></tbody>
                          <i id='Z7UJP'><tr id='Z7UJP'><dt id='Z7UJP'><q id='Z7UJP'><span id='Z7UJP'><b id='Z7UJP'><form id='Z7UJP'><ins id='Z7UJP'></ins><ul id='Z7UJP'></ul><sub id='Z7UJP'></sub></form><legend id='Z7UJP'></legend><bdo id='Z7UJP'><pre id='Z7UJP'><center id='Z7UJP'></center></pre></bdo></b><th id='Z7UJP'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Z7UJP'><tfoot id='Z7UJP'></tfoot><dl id='Z7UJP'><fieldset id='Z7UJP'></fieldset></dl></div>

                          <small id='Z7UJP'></small><noframes id='Z7UJP'>

                          • <bdo id='Z7UJP'></bdo><ul id='Z7UJP'></ul>
                            主站蜘蛛池模板: 成人国产精品入口免费视频 | 日本一区不卡 | 欧美激情亚洲 | 成人免费网站视频 | 国产精品久久久久久久 | 九九99精品 | 免费一区 | 亭亭五月激情 | 成人不卡| 91香蕉视频在线观看 | 国产ts人妖系列高潮 | 99av成人精品国语自产拍 | 一区二区三区欧美 | 特级黄色毛片 | 久久精品在线 | 亚洲人a | 久久大陆| 激情一区二区三区 | 亚洲视频在线免费 | 亚洲精品久久久 | 久久免费观看一级毛片 | 欧美日韩高清免费 | 日韩精品成人网 | 亚洲社区在线 | 国产精品亚洲精品日韩已方 | 亚洲精品乱码久久久久久蜜桃91 | 69福利影院 | 久久精品久久久 | 伊人网在线播放 | 成人精品一区二区三区中文字幕 | 成在线人视频免费视频 | 91视频久久 | 久久亚洲视频网 | 99精品99 | 国产乱码一区 | 九九爱这里只有精品 | 国产精品久久久久久久久久99 | 在线观看av网站永久 | 成人精品国产 | 91国内产香蕉 | 久久久国产一区 |