<?php
include("db.php");
 $counterCurrency=$counterCurrency;
$baseCurrency=$basecurrency;  

 


 $checkRate_sql="select * from crrencyrate where  counterCurrency='$counterCurrency' and baseCurrency='$baseCurrency' order by id desc limit 1";
$checkRate_query= $db ->query($checkRate_sql);
$checkRate_Row=$checkRate_query ->fetch_array();
$checkRate=$checkRate_Row['rate'];

$unit=$checkRate_Row['unit'];

$first_oldRate=$checkRate;
$second_oldRate=$unit;
 if(isset($checkRate)){
   
   $rsultRate=$first_oldRate."/".$second_oldRate;
  //echo "<input  type='text'   class='form-control' id='mixData'    name='currencyPriec'  value=".$first."/".$second.">";
 }
//===============================================================================
if(!isset($checkRate)){
 
$checkRate1_sql="select * from crrencyrate where  counterCurrency='$baseCurrency' and baseCurrency='$counterCurrency' order by id desc limit 1";
$checkRate1_query= $db ->query($checkRate1_sql);
$checkRate1_Row=$checkRate1_query ->fetch_array();
$unit1=$checkRate1_Row['unit'];
$checkRate1=$checkRate1_Row['rate'];
 
 $first_oldRate=$unit1;
//$second=$checkRate1;
 
 $second_oldRate=$checkRate1;
 $rsultRate=$first_oldRate."/".$second_oldRate;
     //echo $result=$unit1/$checkRate1;
//echo "<input  type='text'   class='form-control' id='mixData'    name='currencyPriec'  value=".$first."/".$second.">";
}


    //echo "<input  type='hidden' class='form-control'  name='second' value='$second'>";   
   






?>