<?php
require_once '_flashii.php';
$userId = (int)filter_input(INPUT_GET, 'user', FILTER_SANITIZE_NUMBER_INT);
$fieldId = (int)filter_input(INPUT_GET, 'field', FILTER_SANITIZE_NUMBER_INT);
try {
$fetch = $db->prepare('SELECT `field_value` FROM `msz_profile_fields_values` WHERE `field_id` = ? AND `user_id` = ?');
$fetch->addParameter(1, $fieldId);
$fetch->addParameter(2, $userId);
$fetch->execute();
$result = $fetch->getResult();
if($result->next())
echo json_encode(['field_value' => $result->getString(0)]);
else echo '{"error":105}';
} catch(Exception $ex) {
echo json_encode(['error' => 104, 'msg' => $ex->getMessage()]);
}