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

  • <legend id='yVySh'><style id='yVySh'><dir id='yVySh'><q id='yVySh'></q></dir></style></legend>
    1. <tfoot id='yVySh'></tfoot>
    2. <small id='yVySh'></small><noframes id='yVySh'>

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

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

        用 PHP 創建動態表

        Creating a dynamic table with PHP(用 PHP 創建動態表)

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

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

                <legend id='BDsrP'><style id='BDsrP'><dir id='BDsrP'><q id='BDsrP'></q></dir></style></legend>
                • 本文介紹了用 PHP 創建動態表的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試使用 PHP 制作動態表.我有一個頁面顯示數據庫中的所有圖片.我只需要該表為 5 列.如果返回的圖片超過 5 張,則應創建一個新行,其余圖片將繼續顯示.

                  I'm trying to make a dynamic table with PHP. I have a page which displays all the pictures from a database. I need the table to be of 5 columns only. If more than 5 pictures are returned, it should create a new row and the displaying of the rest of the pics would continue.

                  有人可以幫忙嗎?

                  代碼在這里:主頁中的代碼:-

                  Codes go here: Code in the main page:-

                      <table>
                      <?php
                          $all_pics_rs=get_all_pics();
                          while($pic_info=mysql_fetch_array($all_pics_rs)){
                          echo "<td><img src='".$pic_info['picture']."' height='300px' width='400px' /></td>";
                              } 
                  ?>
                  </table>
                  

                  get_all_pics() 函數:

                  The get_all_pics() function:

                  $all_pics_q="SELECT * FROM pics";
                          $all_pics_rs=mysql_query($all_pics_q,$connection1);
                          if(!$all_pics_rs){
                              die("Database query failed: ".mysql_error());
                          }
                          return $all_pics_rs;
                  

                  此代碼正在創建單行.我想不出如何獲得多行...... !!

                  This code is creating a single row. I can't think of how I can get multiple rows ... !!

                  推薦答案

                  $maxcols = 5;
                  $i = 0;
                  
                  //Open the table and its first row
                  echo "<table>";
                  echo "<tr>";
                  while ($image = mysql_fetch_assoc($images_rs)) {
                  
                      if ($i == $maxcols) {
                          $i = 0;
                          echo "</tr><tr>";
                      }
                  
                      echo "<td><img src="" . $image['src'] . "" /></td>";
                  
                      $i++;
                  
                  }
                  
                  //Add empty <td>'s to even up the amount of cells in a row:
                  while ($i <= $maxcols) {
                      echo "<td>&nbsp;</td>";
                      $i++;
                  }
                  
                  //Close the table row and the table
                  echo "</tr>";
                  echo "</table>";
                  

                  我還沒有測試過,但我的瘋狂猜測是這樣的.只需使用圖像循環瀏覽數據集,只要您還沒有制作 5 個 <td>,就添加一個.到達 5 后,關閉該行并創建一個新行.

                  I haven't tested it yet but my wild guess is something like that. Just cycle through your dataset with the images and as long as you didn't make 5 <td>'s yet, add one. Once you reach 5, close the row and create a new row.

                  這個腳本應該給你類似下面的東西.這顯然取決于您擁有的圖像數量,我假設 5(在 $maxcols 中定義)是您想要連續顯示的最大圖像數量.

                  This script is supposed to give you something like the following. It obviously depends on how many images you have and I assumed that 5 (defined it in $maxcols) was the maximum number of images you want to display in a row.

                  <table>
                      <tr>
                          <td><img src="image1.jpg" /></td>
                          <td><img src="image1.jpg" /></td>
                          <td><img src="image1.jpg" /></td>
                          <td><img src="image1.jpg" /></td>
                          <td><img src="image1.jpg" /></td>
                      </tr>
                      <tr>
                          <td><img src="image1.jpg" /></td>
                          <td><img src="image1.jpg" /></td>
                          <td>&nbsp;</td>
                          <td>&nbsp;</td>
                          <td>&nbsp;<td>
                      </tr>
                  </table>
                  

                  這篇關于用 PHP 創建動態表的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 找不到驅動程序)

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

                            <small id='2BYzn'></small><noframes id='2BYzn'>

                          1. 主站蜘蛛池模板: 99久久国产 | 国产精品欧美一区二区 | 成人av高清 | 91精品中文字幕一区二区三区 | 久久人人网 | 国精产品一区二区三区 | 久久久久久免费免费 | 国产一区二区三区在线 | 久久一区精品 | 亚洲成人一区 | 欧美国产一区二区三区 | 午夜大片 | 奇米影视在线 | 视频一区二区三区中文字幕 | 九色91视频 | 国产成人亚洲精品 | 毛片一区 | 一区在线观看 | 久久久久久久久久久一区二区 | 性一区 | 国产精产国品一二三产区视频 | 视频精品一区二区三区 | 久久com | 成人在线视频免费观看 | 亚洲成人福利视频 | 91精品国产综合久久久动漫日韩 | 综合视频在线 | 亚洲一区二区黄 | 国产精品久久久久久久久久久免费看 | 国产综合精品一区二区三区 | 特黄视频| 一区二区三区视频 | 黄色大片网站 | 国产精品乱码一二三区的特点 | 四虎影院在线免费观看 | 色婷婷在线视频 | 国产精品久久久久久吹潮 | 粉嫩一区二区三区四区公司1 | 91亚洲精选 | 精品一级| 国产九九九|