<?php
require 'db.php';

$contacts = [];
$stmt = $pdo->query("SELECT DISTINCT contact FROM transactions WHERE contact IS NOT NULL AND contact <> '' ORDER BY contact ASC");
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
    $contacts[] = $row['contact'];
}
?>
