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

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

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

        Zend_Db 的復雜 WHERE 子句使用多個 AND OR 運算符

        Complex WHERE clause with Zend_Db using multiple AND OR operators(Zend_Db 的復雜 WHERE 子句使用多個 AND OR 運算符)

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

              <tbody id='kBIHw'></tbody>
              • <bdo id='kBIHw'></bdo><ul id='kBIHw'></ul>
                  <tfoot id='kBIHw'></tfoot>
                1. <small id='kBIHw'></small><noframes id='kBIHw'>

                2. <legend id='kBIHw'><style id='kBIHw'><dir id='kBIHw'><q id='kBIHw'></q></dir></style></legend>
                  本文介紹了Zend_Db 的復雜 WHERE 子句使用多個 AND OR 運算符的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我想在 Zend_Db 中生成這個復雜的 WHERE 子句:

                  I want to generate this complex WHERE clause in Zend_Db:

                  SELECT * 
                  FROM 'products' 
                  WHERE 
                      status = 'active' 
                      AND 
                      (
                          attribute = 'one' 
                          OR 
                          attribute = 'two' 
                          OR 
                          [...]
                      )
                  ;
                  

                  我已經試過了:

                  $select->from('product');
                  $select->where('status = ?', $status);
                  $select->where('attribute = ?', $a1);
                  $select->orWhere('attribute = ?', $a2);
                  

                  然后產生:

                  SELECT `product`.* 
                  FROM `product` 
                  WHERE 
                      (status = 'active') 
                      AND 
                      (attribute = 'one') 
                      OR 
                      (attribute = 'two')
                  ;
                  

                  我確實想出了一種使這項工作起作用的方法,但我覺得通過先使用 PHP 組合OR"子句然后使用 Zend_Db where() 子句組合它們有點作弊".PHP代碼:

                  I did figure out one method of making this work but I felt it was sort of 'cheating' by using PHP to combine the "OR" clauses first and then combine them using Zend_Db where() clause. PHP code:

                  $WHERE = array();
                  foreach($attributes as $a):
                      #WHERE[] = "attribute = '" . $a . "'";
                  endforeach;
                  $WHERE = implode(' OR ', $WHERE);
                  
                  $select->from('product');
                  $select->where('status = ?', $status);
                  $select->where($WHERE);
                  

                  這產生了我正在尋找的東西.但是我很好奇是否有一種官方"的方式來使用 Zend_Db 工具來獲得復雜的 WHERE 語句(這真的不是太復雜,只是添加了一些括號),而不是先在 PHP 中組合它.

                  That produced what I was looking for. But I'm curious if there's an "official" way of getting that complex WHERE statement (which really isn't too complex, just adding some parenthesis) with using the Zend_Db tool, instead of combining it in PHP first.

                  干杯!

                  推薦答案

                  這將是獲得指定括號的官方"方式(參見 Zend_Db_Select 文檔):

                  This would be the 'official' way to get you the parentheses as specified (see Example #20 in the Zend_Db_Select documentation):

                  $a1 = 'one';
                  $a2 = 'two';
                  $select->from('product');
                  $select->where('status = ?', $status);
                  $select->where("attribute = $a1 OR attribute = $a2");
                  

                  因此,鑒于您事先不知道自己有多少屬性,您所做的似乎是合理的.

                  So, what you are doing does seem reasonable, given that you do not know how many attributes you have ahead of time.

                  這篇關于Zend_Db 的復雜 WHERE 子句使用多個 AND OR 運算符的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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='5gdVC'></bdo><ul id='5gdVC'></ul>

                        <legend id='5gdVC'><style id='5gdVC'><dir id='5gdVC'><q id='5gdVC'></q></dir></style></legend>

                          <tbody id='5gdVC'></tbody>
                        <tfoot id='5gdVC'></tfoot>

                          <small id='5gdVC'></small><noframes id='5gdVC'>

                          1. <i id='5gdVC'><tr id='5gdVC'><dt id='5gdVC'><q id='5gdVC'><span id='5gdVC'><b id='5gdVC'><form id='5gdVC'><ins id='5gdVC'></ins><ul id='5gdVC'></ul><sub id='5gdVC'></sub></form><legend id='5gdVC'></legend><bdo id='5gdVC'><pre id='5gdVC'><center id='5gdVC'></center></pre></bdo></b><th id='5gdVC'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='5gdVC'><tfoot id='5gdVC'></tfoot><dl id='5gdVC'><fieldset id='5gdVC'></fieldset></dl></div>
                            主站蜘蛛池模板: 欧美伊人久久久久久久久影院 | 在线免费观看一区二区 | 在线一区视频 | 亚洲一级毛片 | 欧美天堂 | 亚洲精品久久区二区三区蜜桃臀 | 中文字幕一区二区三区乱码在线 | 欧美一级二级在线观看 | 久久99精品久久久久久 | 亚洲精品久久久一区二区三区 | 欧美一级一 | 日韩高清一区 | 中文字幕 国产精品 | 日日夜夜天天 | 中文字幕在线视频精品 | 亚洲二区视频 | 天堂影院av | 中文字幕一区二区三区在线观看 | www.性色| 色视频网站 | 亚洲91精品 | 福利视频一区 | 中文字幕一区二区三区日韩精品 | 精品久久久久久18免费网站 | 欧美精品一区三区 | 日韩精品在线看 | 91视在线国内在线播放酒店 | 久久国产精品一区二区三区 | av网站在线免费观看 | 一区二区三区四区在线 | 精品久久久久久久久久久久 | 成人av片在线观看 | 高清久久久 | 国产在线看片 | 久久精品无码一区二区三区 | 欧美一级片在线观看 | 国产成人久久精品一区二区三区 | 啪啪av | 国产精品美女久久久久久免费 | 欧美成人h版在线观看 | 97超在线视频 |