Postingan lainnya
Buku Ini Koding!
Baru!
Buku ini akan jadi teman perjalanan kamu belajar sampai dapat kerjaan di dunia programming!
Kelas Premium!
Belajar bikin website dari nol sekarang
Gunakan kupon "lebihcepat" untuk diskon 25%!
Pengulangan td dan tr dalam tabel
<?php
include 'config.php';
include 'get-mac.php';
?>
<table class="table table-bordered" border="1">
<thead>
<tr>
<th>Product</th>
<th>Description</th>
<th>Availability</th>
<th>Unit Price</th>
<th>Qty</th>
<th>Total</th>
</tr>
</thead>
<?php
$querytampil = mysqli_query($konn,"SELECT * FROM cart_order JOIN cart_order_detail USING(cart_id)
JOIN product_item USING (item_id) WHERE mac_addr='$mac'");
if(mysqli_num_rows($querytampil)>0){
while($row=mysqli_fetch_array($querytampil)){
?>
<tbody>
<tr>
<td align="center">
<img src="img/uploadproduct/<?php echo $row['filename']?>" height="125px" width="125px">
</td>
<td>
<?php echo $row['item']?>
</td>
<td align="center">
<b>In Stock</b>
</td>
<td align="center">
$ <?php echo $row['price']?>
</td>
<td align="center">
<?php echo $row['qty']?>
</td>
<td align="center">
$ <?php $row['price']*$row['qty']?>
</td>
</tr>
</tbody>
<?php
}}
?>
</table>
hasilnya ini :
dan saya inginnya outputnya seperti ini :
Ada yg bisa bantu untuk posisi pengulangan tr atau td nya ?
0
2 Jawaban:
Kayanya harus di looping satu-2 klw mau begitu gan, misalkan untuk product:
<tr>
<th>Product</th>
<?php
if(mysqli_num_rows($querytampil)>0){
while($row=mysqli_fetch_array($querytampil)){
?>
<td align="center">
<img src="img/uploadproduct/<?php echo $row['filename']?>" height="125px" width="125px">
</td>
<?php }
} ?>
</tr>
0