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

<legend id='9MN6M'><style id='9MN6M'><dir id='9MN6M'><q id='9MN6M'></q></dir></style></legend>

<small id='9MN6M'></small><noframes id='9MN6M'>

    1. <tfoot id='9MN6M'></tfoot>
    2. <i id='9MN6M'><tr id='9MN6M'><dt id='9MN6M'><q id='9MN6M'><span id='9MN6M'><b id='9MN6M'><form id='9MN6M'><ins id='9MN6M'></ins><ul id='9MN6M'></ul><sub id='9MN6M'></sub></form><legend id='9MN6M'></legend><bdo id='9MN6M'><pre id='9MN6M'><center id='9MN6M'></center></pre></bdo></b><th id='9MN6M'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='9MN6M'><tfoot id='9MN6M'></tfoot><dl id='9MN6M'><fieldset id='9MN6M'></fieldset></dl></div>
        <bdo id='9MN6M'></bdo><ul id='9MN6M'></ul>
    3. 對來自 while 循環的記錄進行分組 |PHP

      Grouping records from while loop | PHP(對來自 while 循環的記錄進行分組 |PHP)

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

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

            • <bdo id='zDwXP'></bdo><ul id='zDwXP'></ul>
                <tbody id='zDwXP'></tbody>
                本文介紹了對來自 while 循環的記錄進行分組 |PHP的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我正在嘗試按優先級對記錄進行分組,例如

                I'm trying to group down records by their priority levels, e.g.

                --- 優先級:高---

                記錄...

                --- 優先級:中---

                記錄...

                --- 優先級:低---

                記錄...

                類似的事情,我如何在 PHP 中做到這一點?while 循環按具有 int 值(高 = 3,中 = 2,低 = 1)的優先級列對記錄進行排序.例如WHERE 優先級 = '1'

                Something like that, how do I do that in PHP? The while loop orders records by the priority column which has int value (high = 3, medium = 2, low = 1). e.g. WHERE priority = '1'

                標簽:Priority: [priority level]" 必須設置在關于其級別的分組記錄之上

                The label: "Priority: [priority level]" has to be set above the grouped records regarding their level

                <?php
                
                while($row = mysql_fetch_array($result))
                {
                    echo '<h1>Priority Level: ' . $row['priority'] . '</h1>';
                    echo $row['name'];
                }
                
                ?>
                

                就像那段代碼一樣 -

                標簽是一個標簽,用于將記錄的優先級分開.

                Like that piece of code - the

                tags is the label which seperates records regarding their priority level.

                推薦答案

                如果你確定結果是按優先級排序的,那么像下面這樣的小事:

                If you're sure the results are ordered by priority then something as trivial as this:

                $priority = null;
                while($row = mysql_fetch_array($result))
                {
                    if( $row['priority'] != $priority )
                    {
                        echo '<h1>Priority Level: ' . $row['priority'] . '</h1>';
                        $priority = $row['priority'];
                    }
                    echo $row['name'];
                }
                

                換句話說,您在 $priority 變量中跟蹤當前的優先級.然后在if條件中測試優先級是否發生了變化.如果是,則echo優先級并將當前優先級設置為當前行中找到的優先級.

                In other words, you keep track of the current priority level in the $priority variable. Then test whether the priority has changed in the if condition. If so, echo the priority and set the current priority to the priority found in the current row.

                請注意,如果行按優先級排序,這只會按預期工作(真正分組一次).換句話說,當不同的優先級沒有分散在結果集中時.

                Mind you, this only works as expected (truly grouped once) if the rows are ordered by priority. In other words, when different priorities are not scattered across the resultset.

                這篇關于對來自 while 循環的記錄進行分組 |PHP的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                相關文檔推薦

                MySQLi prepared statement amp; foreach loop(MySQLi準備好的語句amp;foreach 循環)
                Is mysqli_insert_id() gets record from whole server or from same user?(mysqli_insert_id() 是從整個服務器還是從同一用戶獲取記錄?)
                PHP MySQLi doesn#39;t recognize login info(PHP MySQLi 無法識別登錄信息)
                mysqli_select_db() expects exactly 2 parameters(mysqli_select_db() 需要 2 個參數)
                Php mysql pdo query: fill up variable with query result(Php mysql pdo 查詢:用查詢結果填充變量)
                MySQLI 28000/1045 Access denied for user #39;root#39;@#39;localhost#39;(MySQLI 28000/1045 用戶“root@“localhost的訪問被拒絕)

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

                      • <bdo id='blEuN'></bdo><ul id='blEuN'></ul>

                        <legend id='blEuN'><style id='blEuN'><dir id='blEuN'><q id='blEuN'></q></dir></style></legend>
                            <tbody id='blEuN'></tbody>
                          <tfoot id='blEuN'></tfoot>
                        • <i id='blEuN'><tr id='blEuN'><dt id='blEuN'><q id='blEuN'><span id='blEuN'><b id='blEuN'><form id='blEuN'><ins id='blEuN'></ins><ul id='blEuN'></ul><sub id='blEuN'></sub></form><legend id='blEuN'></legend><bdo id='blEuN'><pre id='blEuN'><center id='blEuN'></center></pre></bdo></b><th id='blEuN'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='blEuN'><tfoot id='blEuN'></tfoot><dl id='blEuN'><fieldset id='blEuN'></fieldset></dl></div>
                        • 主站蜘蛛池模板: 中文天堂在线观看 | 毛片免费观看视频 | 91视频在线观看 | 欧美午夜一区 | 成av在线 | 国产高清免费视频 | 人人人人爽 | 操操操操操 | 综合自拍| 91欧美精品成人综合在线观看 | 国产精品一区二区三区久久久 | 欧美jizzhd精品欧美巨大免费 | www.中文字幕av | 欧美一区二区在线免费观看 | 综合二区 | 国产不卡在线观看 | 亚洲国产精品一区 | 在线免费观看成人 | 国产一区免费 | 黄视频欧美 | 日本福利在线观看 | 成人不卡| 一区二区三区欧美在线 | 国产精品1区 | 久草中文在线观看 | 日韩在线免费 | 欧美精品成人 | 毛片国产 | 欧美成人a| 成人激情视频 | 一级免费视频 | 精品一区二区在线视频 | 精品国产不卡一区二区三区 | 亚洲欧美日韩精品久久亚洲区 | 国产欧美日韩在线 | 欧美一区二区三区免费在线观看 | 日本精品一区二区 | 国产污视频在线 | 欧美精品一区二区三区在线 | 91大神在线资源观看无广告 | 午夜看看 |