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

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

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

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

      2. <tfoot id='S3KU5'></tfoot>

        格式化 MySQL 查詢的結果,就好像它是從控制臺運

        Formatting the results of a MySQL query as if it were run from the console(格式化 MySQL 查詢的結果,就好像它是從控制臺運行一樣)
          <legend id='cCJ5n'><style id='cCJ5n'><dir id='cCJ5n'><q id='cCJ5n'></q></dir></style></legend>

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

          • <bdo id='cCJ5n'></bdo><ul id='cCJ5n'></ul>
                <tbody id='cCJ5n'></tbody>

                1. <tfoot id='cCJ5n'></tfoot>

                  <i id='cCJ5n'><tr id='cCJ5n'><dt id='cCJ5n'><q id='cCJ5n'><span id='cCJ5n'><b id='cCJ5n'><form id='cCJ5n'><ins id='cCJ5n'></ins><ul id='cCJ5n'></ul><sub id='cCJ5n'></sub></form><legend id='cCJ5n'></legend><bdo id='cCJ5n'><pre id='cCJ5n'><center id='cCJ5n'></center></pre></bdo></b><th id='cCJ5n'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='cCJ5n'><tfoot id='cCJ5n'></tfoot><dl id='cCJ5n'><fieldset id='cCJ5n'></fieldset></dl></div>
                  本文介紹了格式化 MySQL 查詢的結果,就好像它是從控制臺運行一樣的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在編寫一個快速而骯臟的報告腳本,用于查詢報告并通過電子郵件發送結果.使用 MySQL 控制臺時,結果顯示在格式良好的表格中:

                  I'm writing a quick and dirty reporting script that queries a report and emails the results. When using the MySQL console the results are in a nicely formatted table:

                  mysql> select * from users;
                  +-----------+------------+-------+
                  | firstname | city       | zip   |
                  +-----------+------------+-------+
                  | Maria     | Holland    | 12345 |
                  | Rene      | Doylestown | 65432 |
                  | Helen     | Conway     | 98745 |
                  +-----------+------------+-------+
                  3 rows in set (0.01 sec)
                  

                  在使用 PHP 獲取結果時,是否有一種簡單的方法可以復制這種格式?顯然,我可以通過編寫自己的報告格式化程序來實現這一點,但我希望有一些更優雅的東西.

                  Is there an easy way to replicate this formatting when fetching the results with PHP? Obviously I could achieve this by writing my own report formatter but I was hoping for something a little more elegant.

                  推薦答案

                  您可以使用 輕松完成此操作Console_Table PEAR 包.只需遍歷您的 MySQL 結果,并將行添加到您的表中.您可以使用 Console_Table::setHeaders() 方法為您的列添加標題,然后使用 Console_Table::addRow() 方法添加每一行,最后 Console_Table::getTable() 顯示它.

                  You could do this quite easily using the Console_Table PEAR package. Just loop through your MySQL results, and add rows to your table. You can use the Console_Table::setHeaders() method to add the headers for your columns, then the Console_Table::addRow() method to add each row, and finally Console_Table::getTable() to display it.

                  PHP 沒有內置任何東西來做到這一點.如果您不想使用/編寫代碼來繪制控制臺表,只需使用 passthru() 通過 PHP 將 -e query 傳遞給 mysql.這將工作以 ;G 終止的查詢:

                  There is nothing built into PHP to do this. If you don't want to use/write code to draw console tables, just pass -e query to mysql via PHP using passthru(). This will work queries terminated with both ; and G:

                  passthru("mysql -e '$query;' database_name");
                  

                  這篇關于格式化 MySQL 查詢的結果,就好像它是從控制臺運行一樣的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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='HSlCP'></bdo><ul id='HSlCP'></ul>
                      • <small id='HSlCP'></small><noframes id='HSlCP'>

                          <tbody id='HSlCP'></tbody>

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

                            主站蜘蛛池模板: 天天操一操 | 久久久天堂| 久久久www成人免费无遮挡大片 | 日韩国产免费 | 日韩av成人 | 视频一区二区三区在线观看 | 欧美天堂 | 一区二区三区四区在线播放 | 久久精品小视频 | www.日日操 | 日本超碰| 在线亚洲免费视频 | 日本精品久久久久久久 | 国产精品成人一区二区三区 | 九九亚洲 | 久久久久国产精品午夜一区 | 中文字幕在线观看日韩 | 亚洲欧洲日本国产 | 国产在线色 | 一二三区av | 日本不卡一区 | 国产精品美女久久久免费 | 在线日韩中文字幕 | 国产区视频在线观看 | 国产女人与拘做受视频 | 亚洲视频一区二区三区 | 精品成人佐山爱一区二区 | 亚洲精精品 | 久久国产欧美日韩精品 | 久色网| 欧美色成人 | 日韩精品一区在线 | 91超碰在线 | 欧产日产国产精品v | 久久国产欧美日韩精品 | 欧美一级久久精品 | 欧美激情99 | 亚洲人成在线播放 | 久久精品国产免费 | 操操日 | 丁香婷婷成人 |