<?php
$resource = pg_connect($db_settings);
$fileResponse = pg_query("SELECT id,name,data FROM files WHERE id='1'");
$data = null;
while ($file = pg_fetch_array($fileResponse)){
$data = $file['data'];
}
echo $data;
$date = new \Bitrix\Main\Type\Date();
$date->add('-2 year');
$filter = array('>DATE_INSERT' => $date->toString());
$group = array('USER_ID');
$select = array('USER_ID', 'USER_INFO_' => 'USER');
$userDataByOrders = CSaleOrder::GetList(array(), $filter, $group, false, $select);
$users = array();
while ($userData = $userDataByOrders->Fetch()) {
$users[] = $userData['USER_ID'];
}