【发布时间】:2022-01-04 23:08:15
【问题描述】:
我用来从数据库中获取数据的 SQL
<?php
require 'functions.php';
$pesanan = query("SELECT order_name, order_quantity,table_id FROM `pesanan` WHERE transaction_id = 20;");
?>
循环我可以显示数据,但它仅适用于 transaction_id = 20 的数据
<?php include("temp_sidebar.php");?>
<div class="header">
<h3 class="text-center">Order List</h3>
</div>
<div class="container-two border border-white border-3">
<div class="order_card">
<h4 style="text-align: center" >
<span class="border-bottom border-white border-3">Order 1</span>
</h4>
<div class="ex1">
<?php foreach($order as $row): ?>
<p><?= $row ["order_name"] ?> (<?= $row ["order_quantity"] ?>)</p>
<?php endforeach;?>
</div>
<h6>Table <?= $row ["table_id"] ?></h6>
<div class="d-grid gap-2">
<button class="btn btn-success" type="button">Finish</button>
</div>
</div>
</div>
</div>
【问题讨论】:
-
您正在从数据库中获取查询中具有 20 个 id 的数据。你想如何显示不同的数据可以解释一下吗?