the SQL that i use to get data from data base
<?php
require 'functions.php';
$pesanan = query("SELECT order_name, order_quantity,table_id FROM `pesanan` WHERE transaction_id = 20;");
?>
the loop i can show the data but, it is only for data with 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>
replace this
$pesanan = query("SELECT order_name, order_quantity,table_id FROM `pesanan` WHERE transaction_id = 20;");
to this
$pesanan = query("SELECT order_name, order_quantity,table_id FROM `pesanan` WHERE transaction_id = ".$_GET['id'].";");
then try to access the your site using a parameter '?id=20',exemple:
localhost/myproject/index.php?id=20
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.