<?php
include 'koneksi.php';

$id = $_GET['id'];

// ambil data order yg diklik
$data = mysqli_fetch_assoc(mysqli_query($conn, "
    SELECT username, tanggal 
    FROM orders 
    WHERE id='$id'
"));

$username = $data['username'];
$tanggal  = $data['tanggal'];

// 🔥 update HANYA transaksi ini saja
mysqli_query($conn, "
    UPDATE orders 
    SET status='Dikirim'
    WHERE username='$username' 
    AND tanggal='$tanggal'
    AND status='Dibayar'
");

header("Location: pesanan.php");
?>