久久久久久久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屋-程序員軟件開發(fā)

      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 數據庫(有效)的連接類.然而,我的問題在于我試圖使用這個類來執(zhí)行一個簡單的 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)) {
                  

                  您也執(zhí)行錯誤的語句,應該是:

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

                  $result = $sql->execute();
                  

                  您使用的方法是在不事先準備的情況下執(zhí)行 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模板網!

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

                  相關文檔推薦

                  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>
                            主站蜘蛛池模板: 9l视频自拍九色9l视频成人 | 手机av在线免费观看 | 激情小说图片视频 | 欧美一级片免费 | 三级视频在线观看 | 91久久综合 | 国产黄色在线 | 久久精品99久久久久久 | 亚洲久久久久久 | 91精品国产日韩91久久久久久 | 天堂成人网 | 国产又粗又黄又爽又硬的视频 | 欧美国产视频 | 亚洲天堂偷拍 | 国产又粗又猛视频免费 | 日韩在线成人 | 欧美一级片免费看 | 国产剧情在线 | 一级免费黄色片 | 老司机精品福利视频 | 六月婷婷综合 | 黄色三级网站 | 国产精品毛片久久久久久久 | 成人小视频在线 | 国产精品福利在线观看 | 91免费福利 | 精品乱子伦一区二区三区 | 欧美综合一区 | 超碰成人在线观看 | 精品免费在线观看 | 免费成人黄色网址 | 日韩精品久久 | 精品日韩一区 | 久久一区二区视频 | 精品少妇v888av | 久久精品国产亚洲 | 激情五月综合色婷婷一区二区 | 懂色av一区二区夜夜嗨 | 国模无码大尺度一区二区三区 | 精品一区久久 | 欧美偷拍精品 |