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

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

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

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

      使用 PDO 回顯顯示表中的所有行

      Using PDO to echo display all rows from a table(使用 PDO 回顯顯示表中的所有行)
      • <bdo id='QXQ5N'></bdo><ul id='QXQ5N'></ul>
        <legend id='QXQ5N'><style id='QXQ5N'><dir id='QXQ5N'><q id='QXQ5N'></q></dir></style></legend><tfoot id='QXQ5N'></tfoot>

          <tbody id='QXQ5N'></tbody>

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

              <i id='QXQ5N'><tr id='QXQ5N'><dt id='QXQ5N'><q id='QXQ5N'><span id='QXQ5N'><b id='QXQ5N'><form id='QXQ5N'><ins id='QXQ5N'></ins><ul id='QXQ5N'></ul><sub id='QXQ5N'></sub></form><legend id='QXQ5N'></legend><bdo id='QXQ5N'><pre id='QXQ5N'><center id='QXQ5N'></center></pre></bdo></b><th id='QXQ5N'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='QXQ5N'><tfoot id='QXQ5N'></tfoot><dl id='QXQ5N'><fieldset id='QXQ5N'></fieldset></dl></div>
                本文介紹了使用 PDO 回顯顯示表中的所有行的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我正在嘗試使用 PDO 回顯表的所有行,但遇到了問題.

                I'm trying to echo out all the rows of a table using PDO but am running into trouble.

                用舊的方式做我會這樣做

                With the old way of doing I'd have done it like

                $result = mysql_query($sql);
                while ($row = mysql_fetch_array($result)){
                   $title= $row['title'];
                   $body= $row['body'];
                }
                

                但是我正在嘗試使用 PDO;

                But with PDO I'm trying;

                $result = $db->prepare("SELECT title, body FROM post");
                $result->execute();
                
                while ($row = $db->fetchAll(PDO::FETCH_ASSOC))
                {
                $title = $row['title'];
                $body = $row['body'];
                }
                
                echo $title;
                echo $body;
                

                它一直給我調用未定義的方法 PDO::fetchAll()

                Which keeps giving me Call to undefined method PDO::fetchAll()

                做手冊中給出的例子

                <?php
                $sth = $dbh->prepare("SELECT name, colour FROM fruit");
                $sth->execute();
                
                /* Fetch all of the remaining rows in the result set */
                print("Fetch all of the remaining rows in the result set:
                ");
                $result = $sth->fetchAll();
                print_r($result);
                ?>
                

                有效,但我認為我無法像使用 $row=['blah']; 那樣控制各個列.我呢?它也像這樣打印出來;比較丑:

                Works, but I don't think I have control over the individual colums like I would with a $row=['blah']; do I? It also prints out like this; rather ugly:

                Array ( [0] => Array ( [title] => 這是數據庫中輸入的測試標題[0]

                Array ( [0] => Array ( [title] => This is the test title entered in the database[0]

                需要做什么才能正確使用 PDO 來做到這一點?

                What needs to be done to properly use PDO to do this?

                推薦答案

                change:

                while ($row = $db->fetchAll(PDO::FETCH_ASSOC))
                {
                $title = $row['title'];
                $body = $row['body'];
                }
                

                到:

                while ($row = $result->fetch(PDO::FETCH_ASSOC))
                {
                $title = $row['title'];
                $body = $row['body'];
                }
                

                這篇關于使用 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 找不到驅動程序)

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

                          <tbody id='nixyT'></tbody>

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

                        1. <tfoot id='nixyT'></tfoot>
                          主站蜘蛛池模板: 色综合久久天天综合网 | 91视频在线 | 91精品国产91久久久久久密臀 | 欧洲精品一区 | 亚洲精品国产电影 | 欧美a级成人淫片免费看 | 亚洲精品1区 | 一区二区在线观看免费视频 | 亚洲精品无 | 亚洲在线 | 欧美一区二区三区久久精品 | 成人欧美一区二区 | 狠狠热视频 | 亚洲嫩草| 午夜国产 | 精品一区二区三区在线观看国产 | 欧美一区二区三区视频 | 成人av在线播放 | 羞羞视频在线免费 | 国产精品国产三级国产aⅴ浪潮 | 亚洲欧美综合网 | 中文字幕一区在线观看视频 | 欧美日韩国产一区二区三区 | 中文字幕视频在线 | 一区二区三区视频在线观看 | 日本精品一区二区 | 亚洲午夜在线 | 九九成人 | 91一区二区三区在线观看 | 成人免费精品视频 | 蜜桃免费一区二区三区 | 午夜丰满寂寞少妇精品 | 美女在线观看av | 午夜婷婷激情 | 四虎影院免费在线播放 | 男女激情网站免费 | 五月槐花香 | 久久99这里只有精品 | 国产特级毛片 | 四虎在线播放 | 黑人一级黄色大片 |