'Sale ID not provided.']); exit; } $sale_id = $_GET['sale_id']; $pdo = db(); $stmt = $pdo->prepare(" SELECT si.quantity, si.price, p.name as product_name FROM sale_items si JOIN products p ON si.product_id = p.id WHERE si.sale_id = ? "); $stmt->execute([$sale_id]); $items = $stmt->fetchAll(PDO::FETCH_ASSOC); echo json_encode($items);