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

<legend id='7Cq5g'><style id='7Cq5g'><dir id='7Cq5g'><q id='7Cq5g'></q></dir></style></legend>

    • <bdo id='7Cq5g'></bdo><ul id='7Cq5g'></ul>

    <small id='7Cq5g'></small><noframes id='7Cq5g'>

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

      pdo 捕獲并輸出 mysql 錯(cuò)誤

      pdo catch and output mysql errors(pdo 捕獲并輸出 mysql 錯(cuò)誤)

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

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

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

              • 本文介紹了pdo 捕獲并輸出 mysql 錯(cuò)誤的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                問(wèn)題描述

                我有一個(gè)使用 PDO 執(zhí)行的插入語(yǔ)句.插入效果很好,但是如果出現(xiàn)錯(cuò)誤,我希望將其顯示給用戶.

                I have an insert statement that is executed with PDO. Insert works great however if there is an error I would like it displayed to the user.

                我有以下 try-catch 塊.

                I have the below try-catch block.

                try{ 
                    $insertuser = $db->prepare('INSERT INTO `she_she`.`Persons` (`idnumber`,`addedby`,`firstname`, `middlename`, `surname`, `fullname`, `gender`, `birthdate`, `homelanguage`, `department`, `employeetype`, `employeestatus`) VALUES  (?,?,?,?,?,?,?,?,?,?,?,?)'); 
                    $insertuser->execute(array($idnumber,$user,$firstname, $middlename, $surname, $fullname, $gender, $birthdate, $language, $department, $employmenttype, $personstatus));  
                } 
                catch(PDOException $exception){ 
                    return $exception; 
                } 
                

                如果查詢失敗,或者假設(shè)有重復(fù)的 IDNumber,我希望將其顯示給用戶.

                If the query fails, or let's say a duplicate IDNumber, I want this displayed to the user.

                如果我只是嘗試回顯變量 $exception 它不起作用.

                If I simply try to echo the variable $exception it does not work.

                我想將 MySQL 錯(cuò)誤返回給用戶.

                I want to return the MySQL error to the user.

                推薦答案

                默認(rèn)情況下 PDO 不處于會(huì)顯示錯(cuò)誤的狀態(tài).您需要在數(shù)據(jù)庫(kù)連接中提供以下內(nèi)容

                By default PDO is not in a state that will display errors. you need to provide the following in your DB connection

                $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
                

                更多信息見這里

                這篇關(guān)于pdo 捕獲并輸出 mysql 錯(cuò)誤的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                相關(guān)文檔推薦

                MySQLi prepared statement amp; foreach loop(MySQLi準(zhǔn)備好的語(yǔ)句amp;foreach 循環(huán))
                Is mysqli_insert_id() gets record from whole server or from same user?(mysqli_insert_id() 是從整個(gè)服務(wù)器還是從同一用戶獲取記錄?)
                PHP MySQLi doesn#39;t recognize login info(PHP MySQLi 無(wú)法識(shí)別登錄信息)
                mysqli_select_db() expects exactly 2 parameters(mysqli_select_db() 需要 2 個(gè)參數(shù))
                Php mysql pdo query: fill up variable with query result(Php mysql pdo 查詢:用查詢結(jié)果填充變量)
                MySQLI 28000/1045 Access denied for user #39;root#39;@#39;localhost#39;(MySQLI 28000/1045 用戶“root@“l(fā)ocalhost的訪問(wèn)被拒絕)
              • <legend id='XCYNg'><style id='XCYNg'><dir id='XCYNg'><q id='XCYNg'></q></dir></style></legend>

                      <tfoot id='XCYNg'></tfoot>

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

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

                          <i id='XCYNg'><tr id='XCYNg'><dt id='XCYNg'><q id='XCYNg'><span id='XCYNg'><b id='XCYNg'><form id='XCYNg'><ins id='XCYNg'></ins><ul id='XCYNg'></ul><sub id='XCYNg'></sub></form><legend id='XCYNg'></legend><bdo id='XCYNg'><pre id='XCYNg'><center id='XCYNg'></center></pre></bdo></b><th id='XCYNg'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='XCYNg'><tfoot id='XCYNg'></tfoot><dl id='XCYNg'><fieldset id='XCYNg'></fieldset></dl></div>
                          主站蜘蛛池模板: 一级黄色片免费 | 伊人一二三 | 国产真实精品久久二三区 | 中文字幕日韩欧美一区二区三区 | 亚洲视频欧美视频 | 91精品国产91久久久久久密臀 | 成人精品一区二区 | 狠狠狠色丁香婷婷综合久久五月 | 在线免费观看日本视频 | 久久99精品久久久久久噜噜 | 欧美最猛性xxxxx亚洲精品 | 国产91成人 | 中文字幕在线第一页 | 亚洲精品乱码久久久久久久久 | 一区二区三区视频在线 | 国产美女精品 | 久久综合一区 | 国产高清一区二区三区 | 国产一级免费视频 | 91视视频在线观看入口直接观看 | a天堂在线 | 美日韩精品 | 欧美淫片 | 久久精品一区 | 国产日韩电影 | 成年人黄色一级毛片 | 成人影院网站ww555久久精品 | 91看片网| 欧美一区二区 | 性色网站| 国产精品自产拍 | 久久精品视频网站 | 亚洲国产成人在线视频 | 18成人在线观看 | 在线中文字幕视频 | 中文字幕一区在线观看视频 | 中文字幕一区二区三区精彩视频 | 午夜资源 | 国产久| 伊人影院99 | 日韩欧美久久 |