<?php
include 'includes/connect.php';

$order_id = $_GET['id'];

$order = mysqli_fetch_assoc(mysqli_query($conn,"
SELECT * FROM orders WHERE id='$order_id'
"));

$items = mysqli_query($conn,"
SELECT * FROM order_items WHERE order_id='$order_id'
");
?>

<div style="font-size:14px;">

<p><b>Name:</b> <?php echo $order['name']; ?></p>
<p><b>Mobile:</b> <?php echo $order['mobile']; ?></p>
<p><b>Address:</b> <?php echo $order['address']; ?></p>
<p><b>City:</b> <?php echo $order['city']; ?></p>
<p><b>Payment:</b> <?php echo $order['payment_method']; ?></p>
<p><b>Total:</b> ₹ <?php echo number_format($order['total_amount'],2); ?></p>
<p><b>Status:</b> <?php echo $order['status']; ?></p>

<hr>

<h4>🛒 Items</h4>

<?php while($it = mysqli_fetch_assoc($items)) { ?>

<div style="border:1px solid #eee;padding:10px;border-radius:10px;margin-bottom:10px;">
<b><?php echo $it['brand']; ?></b><br>
Qty: <?php echo $it['quantity']; ?><br>
Price: ₹ <?php echo $it['price']; ?><br>
Total: ₹ <?php echo $it['total']; ?>
</div>

<?php } ?>

</div>