<?php
require_once "../../includes/db.php";
header('Content-Type: application/json');

$id = $_POST['id'] ?? 0;

$stmt = $pdo->prepare("
    SELECT id, co_id, p_name, sku , pdt_type, status, pdt_categ, sale_count, reporting_order, p_sale_px, sale_comm, sale_vat, admin_fee, p_prch_px, prch_comm, inp_vat, margin
    FROM products
    WHERE id = ?
");

$stmt->execute([$id]);
echo json_encode($stmt->fetch(PDO::FETCH_ASSOC));
exit;