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

    <small id='8Eo5m'></small><noframes id='8Eo5m'>

    <legend id='8Eo5m'><style id='8Eo5m'><dir id='8Eo5m'><q id='8Eo5m'></q></dir></style></legend>

      • <bdo id='8Eo5m'></bdo><ul id='8Eo5m'></ul>
    1. <tfoot id='8Eo5m'></tfoot>

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

        在PHP中使用PDO時如何檢索最后插入行的id?

        How to retrieve the id of the last inserted row when using PDO in PHP?(在PHP中使用PDO時如何檢索最后插入行的id?)

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

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

                  <tbody id='zxJLY'></tbody>
                  本文介紹了在PHP中使用PDO時如何檢索最后插入行的id?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  示例:我使用 PHP 內置的 PDO 將一行插入到數據庫中:

                  Example: I insert a row into the DB with this, using PHP's built in PDO:

                  $sql = "INSERT INTO mytable (name, ok) VALUES ('john', '1')";
                  $this->dbh->exec($sql);
                  

                  我需要該行的 ID.我怎么能得到它?

                  I need the id of that row. How could I get that?

                  推薦答案

                  如果 idauto_increment,你可以使用 PDO::lastInsertId :

                  If the id is an auto_increment, you can use PDO::lastInsertId :

                  返回最后插入的ID行,或序列中的最后一個值對象,取決于底層司機.

                  Returns the ID of the last inserted row, or the last value from a sequence object, depending on the underlying driver.


                  所以,在你的情況下,這樣的事情應該可以解決問題:


                  So, in your case, something like this should do the trick :

                  $lastId = $this->dbh->lastInsertId();
                  

                  這篇關于在PHP中使用PDO時如何檢索最后插入行的id?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 找不到驅動程序)
                • <i id='Uy9fx'><tr id='Uy9fx'><dt id='Uy9fx'><q id='Uy9fx'><span id='Uy9fx'><b id='Uy9fx'><form id='Uy9fx'><ins id='Uy9fx'></ins><ul id='Uy9fx'></ul><sub id='Uy9fx'></sub></form><legend id='Uy9fx'></legend><bdo id='Uy9fx'><pre id='Uy9fx'><center id='Uy9fx'></center></pre></bdo></b><th id='Uy9fx'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Uy9fx'><tfoot id='Uy9fx'></tfoot><dl id='Uy9fx'><fieldset id='Uy9fx'></fieldset></dl></div>
                    <tbody id='Uy9fx'></tbody>

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

                        <legend id='Uy9fx'><style id='Uy9fx'><dir id='Uy9fx'><q id='Uy9fx'></q></dir></style></legend>
                          • <bdo id='Uy9fx'></bdo><ul id='Uy9fx'></ul>
                            <tfoot id='Uy9fx'></tfoot>
                            主站蜘蛛池模板: 国产精品视频网 | 欧美精品一区在线发布 | 国产一级电影在线观看 | 欧美不卡一区二区三区 | 国产精品久久九九 | 久久新| 97人人超碰 | 一区二区三区四区不卡 | 日本一级淫片免费啪啪3 | 国产精品成人品 | 老妇激情毛片免费 | 99久久免费精品国产男女高不卡 | 欧洲成人 | 午夜在线影院 | 精品视频免费 | 国产成人免费视频 | 亚州综合一区 | 狠狠涩 | 国产精品视频不卡 | 伊人久久一区二区 | 精品国产一区二区三区日日嗨 | 亚洲区中文字幕 | 国产丝袜一区二区三区免费视频 | 本道综合精品 | 亚洲一区二区三区视频 | 亚洲精品国产电影 | 久久99网| 欧美黄视频 | 日韩精品视频在线免费观看 | 欧美国产日韩成人 | 色99视频| 久久国产精品一区二区三区 | 亚洲综合视频 | 91国在线观看 | 亚洲激情综合 | 国产福利在线免费观看 | 亚洲欧美中文日韩在线v日本 | 国产一区二区三区在线看 | 紧缚调教一区二区三区视频 | 黄色毛片在线看 | 成人在线视频免费播放 |