<?php
require 'config/db.php';
$id = $_GET['id'] ?? 0;
$stmt = $pdo->prepare("SELECT COALESCE(balance,0) AS balance FROM customers WHERE id=?");
$stmt->execute([$id]);
echo json_encode($stmt->fetch());