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

$comp_id = isset($_GET['comp_id']) ? (int)$_GET['comp_id'] : 0;

$stmt = $pdo->prepare("
    SELECT id, acc_name
    FROM accounts
    WHERE status = 'active' AND  acc_categ='customer'
    AND co_id = :comp_id
    ORDER BY id ASC
");

$stmt->execute(['comp_id' => $comp_id]);

echo json_encode($stmt->fetchAll(PDO::FETCH_ASSOC));