我正在處理以下代碼。我需要在表中添加每個類別的所有值。數(shù)據(jù)來自數(shù)據(jù)庫。請先看圖片:這是我的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>這是我學(xué)校的項目。
- 3 回答
- 0 關(guān)注
- 404 瀏覽
添加回答
舉報
0/150
提交
取消