<?php
include("db.php");
   $ccurrencyId=$_POST['counterCurrency'];  //ارزی که باید کم شود
 


$checkRate_sql="select * from crrencyrate where  counterCurrency='$ccurrencyId' and baseCurrency='1' 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=$checkRate;
$second=$unit;
 if(isset($checkRate)){
   $first=$checkRate;
   $second=$unit;
  //echo "<input  type='text'   class='form-control' id='dollarmixData'    name='dollarRatePrice'  value=".$first."/".$second.">";
 }
//===============================================================================
if(!isset($checkRate)){
 
 $checkRate1_sql="select * from crrencyrate where  counterCurrency='1' and baseCurrency='$ccurrencyId' 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=$unit1;
 
 
 $second=$checkRate1;

    
//echo "<input  type='text'   class='form-control' id='dollarmixData'    name='dollarRatePrice'  value=".$first."/".$second.">";
}

?>