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

    <bdo id='LJWwn'></bdo><ul id='LJWwn'></ul>

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

      如何使用 PHP 生成動態(tài) MySQL 數(shù)據(jù)透視表?

      How do I produce a dynamic MySQL pivot table with PHP?(如何使用 PHP 生成動態(tài) MySQL 數(shù)據(jù)透視表?)
        <tbody id='IMMuw'></tbody>
    2. <tfoot id='IMMuw'></tfoot>

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

              <i id='IMMuw'><tr id='IMMuw'><dt id='IMMuw'><q id='IMMuw'><span id='IMMuw'><b id='IMMuw'><form id='IMMuw'><ins id='IMMuw'></ins><ul id='IMMuw'></ul><sub id='IMMuw'></sub></form><legend id='IMMuw'></legend><bdo id='IMMuw'><pre id='IMMuw'><center id='IMMuw'></center></pre></bdo></b><th id='IMMuw'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='IMMuw'><tfoot id='IMMuw'></tfoot><dl id='IMMuw'><fieldset id='IMMuw'></fieldset></dl></div>
              • <bdo id='IMMuw'></bdo><ul id='IMMuw'></ul>
                <legend id='IMMuw'><style id='IMMuw'><dir id='IMMuw'><q id='IMMuw'></q></dir></style></legend>
              • 本文介紹了如何使用 PHP 生成動態(tài) MySQL 數(shù)據(jù)透視表?的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                問題描述

                我在 MySQL 中有一個(gè)名為updates"的表,目前包含以下信息:

                I have a table in MySQL named "updates" that currently holds the following information:

                我需要的是以下內(nèi)容:

                我有以下有效的 MySQL 查詢:

                I have the following MySQL query that works:

                SET @sql = NULL;
                
                SELECT
                  GROUP_CONCAT(DISTINCT
                     CONCAT(
                       'MAX(IF(Date = ''',
                   Date,
                   ''', Description, NULL)) AS ',
                   CONCAT("'",Date,"'")
                 )
                   ) INTO @sql
                FROM updates;
                
                SET @sql = CONCAT('SELECT Action, ', @sql, ' FROM updates GROUP BY Action');
                
                PREPARE stmt FROM @sql;
                EXECUTE stmt;
                

                實(shí)際問題

                我無法弄清楚如何使用 PHP 執(zhí)行此操作,以便我可以在網(wǎng)頁上顯示此輸出.是否有人能夠向我提供 PHP 代碼來執(zhí)行此操作,或者為我指明所需信息的正確方向.

                The actual Question

                I am not able to work out how to execute this using PHP so that I can display this output on a webpage. Is anyone able to either provide me with the PHP code to perform this or point me in the right direction of information required.

                我已經(jīng)閱讀了許多文章,但我認(rèn)為問題在于我不知道我實(shí)際上在尋找什么.起初我認(rèn)為這是如何在 PHP 中運(yùn)行準(zhǔn)備好的語句,但這似乎沒有幫助.

                I have read a number of articles but I think the issue is that I don't know what I'm actually looking for. At first I assumed it was how to run prepared statements within PHP but this didn't appear to help.

                推薦答案

                假設(shè)您使用的是 mysqli(而不是 PDO),您不能使用簡單的 query(),因?yàn)槟獔?zhí)行多個(gè)命令.您需要將 multi_query() 與 store_result()、more_results() 和 next_result() 結(jié)合使用.

                Assuming you are using mysqli (and not PDO) you can't use a simple query() because you want to execute multiple commands. You will need to use multi_query() in combination with store_result(), more_results() and next_result().

                這是我曾經(jīng)使用過的一些代碼:

                Here is some code I used once:

                $db=mysqli_connect($databasehost,$databaseuser,$databasepass,$databasename) or die ("Connection failed!");
                $result = $db->multi_query($sql);
                
                if ($err=mysqli_error($db)) { echo $err."<br><hr>"; }
                
                if ($result) {
                  do {
                  if ($res = $db->store_result()) {
                      echo "<table width=100% border=0><tr>";
                
                      // printing table headers
                      for($i=0; $i<mysqli_num_fields($res); $i++)
                      {
                          $field = mysqli_fetch_field($res);
                          echo "<td bgcolor=lightgray><b>{$field->name}</b></td>";
                      }
                      echo "</tr>
                ";
                
                      // printing table rows
                      while($row = $res->fetch_row())
                      {
                          echo "<tr>";
                          foreach($row as $cell) {
                            if ($cell === NULL) { $cell = '(null)'; }
                            echo "<td>$cell</td>";
                          }
                          echo "</tr>
                ";
                      }
                      $res->free();
                      echo "</table>";
                
                    }
                  } while ($db->more_results() && $db->next_result());
                }
                $db->close();
                

                這篇關(guān)于如何使用 PHP 生成動態(tài) MySQL 數(shù)據(jù)透視表?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 可滾動游標(biāo)不起作用)
                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 獲取一個(gè)值;等于變量的值)
                MSSQL PDO could not find driver(MSSQL PDO 找不到驅(qū)動程序)

                  <tfoot id='NNoxi'></tfoot>
                1. <legend id='NNoxi'><style id='NNoxi'><dir id='NNoxi'><q id='NNoxi'></q></dir></style></legend>
                  • <bdo id='NNoxi'></bdo><ul id='NNoxi'></ul>

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

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

                        <tbody id='NNoxi'></tbody>
                        1. 主站蜘蛛池模板: 99热在这里只有精品 | 欧美二区在线 | 久久精品国产一区 | 福利色导航 | 国产精品亚洲成在人线 | 日韩黄色av | 国产在视频一区二区三区吞精 | 国产高清精品一区二区三区 | 成人二区 | 久久久久久国产 | 欧美午夜精品理论片a级按摩 | 日韩欧美在线视频观看 | 欧美国产日韩在线观看 | 热久色 | 国产成人叼嘿视频在线观看 | 日韩欧美一区在线 | 国产精品污污视频 | 成人免费视频网站在线看 | 精品国产欧美一区二区三区成人 | 欧美精品在线一区二区三区 | 亚洲欧美日韩精品 | 亚洲一区二区av | av特级毛片| 一级一级一级毛片 | 综合精品久久久 | 久久久91精品国产一区二区三区 | 亚洲精选一区二区 | 亚洲一区二区三区在线播放 | 97精品视频在线观看 | 久久综合一区 | 99国产精品久久久 | 久久久婷| 国产一级片 | 久久精品日 | 国产视频福利一区 | 日韩欧美一区在线 | 在线观看中文字幕视频 | 色综合天天天天做夜夜夜夜做 | 久久一区 | 亚洲深夜福利 | 一区二区三区视频在线观看 |