File size: 533 Bytes
56fb0d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
header("Content-Type: application/json");
include "db.php";

if (!isset($_GET["order_id"])) {
    echo json_encode(["status" => "error", "message" => "Order ID required"]);
    exit;
}

$order_id = $_GET["order_id"];

$stmt = $conn->prepare("SELECT status FROM orders WHERE id = ?");
$stmt->execute([$order_id]);
$order = $stmt->fetch();

if ($order) {
    echo json_encode(["status" => "success", "order_status" => $order['status']]);
} else {
    echo json_encode(["status" => "error", "message" => "Order not found"]);
}
?>