久久久久久久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 內(nèi)置的 PDO 將一行插入到數(shù)據(jù)庫中:

                  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();
                  

                  這篇關(guān)于在PHP中使用PDO時如何檢索最后插入行的id?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guā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 和魔術(shù)方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅(qū)動程序)
                • <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>
                            主站蜘蛛池模板: 久久亚洲高清 | 中文字字幕在线中文乱码范文 | 国产真实精品久久二三区 | 精品乱码一区二区三四区视频 | 亚洲性人人天天夜夜摸 | 免费视频一区二区 | 天天插天天操 | 欧美福利三区 | 亚洲毛片网站 | 99国产精品久久久久 | 日韩精品一区二区三区在线观看 | 国产精品区二区三区日本 | 日日干夜夜干 | 国产精品久久精品 | 国产精品日产欧美久久久久 | 91精品国产色综合久久不卡98口 | 精品久久久久久久久久久久久久 | 在线观看中文字幕视频 | 欧美亚洲国产一区二区三区 | www.五月婷婷.com | 久草福利 | 国产精品178页 | 999精彩视频 | 国产91丝袜在线播放 | 国产高清视频在线观看播放 | 欧美a在线看 | 九九九久久国产免费 | av超碰 | 免费同性女女aaa免费网站 | 久久精品亚洲一区 | 国产精久久久久久 | 一区二区三区 在线 | 美女视频黄色片 | 成人免费观看男女羞羞视频 | 欧美综合自拍 | 亚洲精品一二三区 | 亚洲三级av | 国产精品久久久久久久久免费软件 | 国产精品视频在线播放 | 成人免费视频网站在线看 | 午夜在线小视频 |