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

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

    1. <small id='JUJMR'></small><noframes id='JUJMR'>

        <legend id='JUJMR'><style id='JUJMR'><dir id='JUJMR'><q id='JUJMR'></q></dir></style></legend><tfoot id='JUJMR'></tfoot>
        • <bdo id='JUJMR'></bdo><ul id='JUJMR'></ul>

        忽略特定的 WHERE 標準

        Ignore particular WHERE criteria(忽略特定的 WHERE 標準)
      1. <legend id='Z2fQZ'><style id='Z2fQZ'><dir id='Z2fQZ'><q id='Z2fQZ'></q></dir></style></legend>
            • <bdo id='Z2fQZ'></bdo><ul id='Z2fQZ'></ul>

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

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

                • 本文介紹了忽略特定的 WHERE 標準的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我想執行參數化查詢,以通過用戶提供的參數執行搜索.有相當多的參數,并不是所有的參數都會一直提供.如果用戶沒有選擇有意義的參數值,我如何進行指定所有可能參數的標準查詢,但忽略其中一些參數?

                  I want to execute a parameterized query to perform a search by user-supplied parameters. There are quite a few parameters and not all of them are going to be supplied all the time. How can I make a standard query that specifies all possible parameters, but ignore some of these parameters if the user didn't choose a meaningful parameter value?

                  這是一個虛構的例子來說明我要做什么

                  Here's an imaginary example to illustrate what I'm going for

                  $sql = 'SELECT * FROM people WHERE first_name = :first_name AND last_name = :last_name AND age = :age AND sex = :sex';
                  $query = $db->prepare($sql);
                  $query->execute(array(':first_name' => 'John', ':age' => '27');
                  

                  顯然,這是行不通的,因為提供的參數數量與預期參數的數量不匹配.我是否必須每次都只在 WHERE 子句中包含指定的參數來制作查詢,或者有沒有辦法讓這些參數中的一些被忽略或在檢查時總是返回 true?

                  Obviously, this will not work because the number of provided parameters does not match the number of expected parameters. Do I have to craft the query every time with only the specified parameters being included in the WHERE clause, or is there a way to get some of these parameters to be ignored or always return true when checked?

                  推薦答案

                  SELECT * FROM people 
                  WHERE (first_name = :first_name or :first_name is null)
                  AND (last_name = :last_name or :last_name is null)
                  AND (age = :age or :age is null)
                  AND (sex = :sex or :sex is null)
                  

                  傳遞參數時,為不需要的提供null.

                  When passing parameters, supply null for the ones you don't need.

                  請注意,為了能夠以這種方式運行查詢,必須將 PDO 的 emulation mode 設為 ON

                  Note that to be able to run a query this way, emulation mode for PDO have to be turned ON

                  這篇關于忽略特定的 WHERE 標準的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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='9IVB2'></bdo><ul id='9IVB2'></ul>

                        <tbody id='9IVB2'></tbody>
                        <legend id='9IVB2'><style id='9IVB2'><dir id='9IVB2'><q id='9IVB2'></q></dir></style></legend>

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

                            主站蜘蛛池模板: 日韩在线一区二区三区 | 欧美精品1区2区3区 免费黄篇 | 天天干在线播放 | 一级毛片在线播放 | 国产成人免费一区二区60岁 | 99国产精品久久久久 | 成人在线中文字幕 | 中文字幕 视频一区 | 久久久91 | 巨大荫蒂视频欧美另类大 | 91麻豆蜜桃一区二区三区 | 99精品视频免费观看 | 日韩欧美国产一区二区三区 | 亚洲精品一区国产精品 | 欧美日韩精品免费 | 一区二区三区四区电影视频在线观看 | 亚洲二区在线 | h在线免费观看 | 免费高清av| 一区二区三区不卡视频 | 国产成人精品一区 | 婷婷色国产偷v国产偷v小说 | 国产视频久久久 | 色在线免费 | 久久岛国| 一区二区三区免费 | 一二区视频| 日韩一区二区在线观看 | 国内精品久久久久 | 黄色网毛片| 久久99精品久久久久久琪琪 | 久久成人精品 | 男女在线免费观看 | 国产精品高潮呻吟久久久久 | 亚洲精精品 | 老司机精品福利视频 | 久久专区 | 日韩在线精品强乱中文字幕 | 精品91久久 | av中文字幕在线播放 | 中文字幕不卡视频在线观看 |