$diriction_mage = array();
while($xml_currency_row = mysql_fetch_array($xml_currency)){
$give = mysql_fetch_array(mysql_query("SELECT * FROM `currency` WHERE `id` = '".$xml_currency_row['give']."'"));
$get = mysql_fetch_array(mysql_query("SELECT * FROM `currency` WHERE `id` = '".$xml_currency_row['get']."'"));
$reserve = mysql_fetch_array(mysql_query("SELECT * FROM `currency` WHERE `id` = '".$xml_currency_row['get']."'"));
$direction = array($give['name_xml'] => array('to' => array($get['name_xml'] => array('in' => intval ($xml_currency_row['give_course']), 'amount' => intval ($reserve['reserve']), 'in_min_amount' => intval($xml_currency_row['min_amount']), in_fee => array('%',2 )))));
array_push($diriction_mage,$direction);
}
$json = array('exchanges' => array('from' => $diriction_mage) );
echo json