我想用Bootstrap Card显示我的订单,但实际上我不能将所有订单都放在单独的Card中。我在mysql表的新卡中获得了每一行。例如,如果我有 1个 2个 1个 2个 3 C
它将显示我(1 A)(2 A)(1 B)(2 B)(3 C)但我想要(1 A B)(2 A B)(3 C)
为演示起见,我用虚拟值制作了屏幕截图。
我的代码是:
<?php
$sql = 'SELECT DISTINCT(tbl_orders.uid), article from tbl_orders ';
$stmt = $conn -> prepare($sql);
$stmt->execute();
$sql1 = 'SELECT tbl_orders.article from tbl_orders GROUP BY tbl_orders.uid';
$stmt1 = $conn -> prepare($sql1);
$stmt1->execute();
?>
<?php while ($row = $stmt -> fetch ()) {
$red = $row['uid'];?>
<div class="card">
<h1><?php echo $row['uid']; ?></h1>
<h2><?php echo $row['article'];?></h2>
<h3><?php
?></h3>
</div>
<?php }?>