如何在HTML表格栏中添加值

我正在处理以下代码。我需要在表中添加每个类别的所有值。数据来自数据库。请先看图片:

http://img4.mukewang.com/60828c30000149ad10440542.jpg

这是我的HTML代码:


<table id="data" class="table table-bordered table-striped">

            <thead>

            <tr align="center">

              <th width="5%">Item</th>

              <th width="30%">Description</th>

              <th width="5%">Unit</th>

              <th width="5%">Qty</th>

              <th width="10%">Unit Cost</th>

              <th width="15%">Amount</th>

            </tr>

            </thead>

            <tbody>

              <tr>

                <td>1</td>

                <td colspan="5"><i>General Requirement</i></td>

              </tr>


              <?php  

              $id = $_GET['id'];

              $select_bill = "SELECT *, quantity * unit_cost AS amount FROM bill_tbl WHERE project_name = $id";

              $select_bill_result = mysqli_query($con,$select_bill);

              if (mysqli_num_rows($select_bill_result)> 0) {

                while ($row = mysqli_fetch_assoc($select_bill_result)) {

                  if ($row['category'] == 'General Requirement') {

              ?>


              <tr>

                <td></td>

                <td><?php echo $row['description']; ?></td>

                <td><?php echo $row['unit']; ?></td>

                <td><?php echo $row['quantity']; ?></td>

                <td><?php echo $row['unit_cost']; ?></td>

                <td><?php echo $row['amount']; ?></td>

              </tr>

              <?php

                   }

                }

              }

              ?>

              <tr>

                <td></td>

                <td colspan="4"><b>Subtotal</b></td>

                <td></td>

              </tr>


              <tr>

                <td>2</td>

                <td colspan="5"><i>Concrete and Masonry Works</i></td>

              </tr>

这是我学校的项目。


元芳怎么了
浏览 343回答 3
3回答
打开App,查看更多内容
随时随地看视频慕课网APP