title: get nearest latitude and longitude
body: <p>I have latitude and longitude in this format : 
    15.1393658,76.92150059999994,13.0873783,77.41112120000003,14.7017498,77.59016529999997</p>
  
  <p>If I enter the another Latitude and longitude like lat=13.0874193,lan=77.41100640000002 they has to give nearest lat lan of above lat lan.
  I have used Haversine Formula,
  $connection = Yii::$app->getDb();</p>
  
  <pre><code>    $command = $connection-&gt;createCommand('
          SELECT fpro_userid, 6371 * 2 * ASIN(SQRT( POWER(SIN(('.$user_lat.' - abs('.$new_string.')) * pi()/180 / 2),2) + COS('.$user_lan.' * pi()/180 ) * COS( abs('.$new_string.') * pi()/180) * POWER(SIN(('.$user_lan.' - '.$new_string.') * pi()/180 / 2), 2) )) as distance FROM farm_profile having distance &lt; 19.2 ORDER BY distance
      ');  
  
      $result = $command-&gt;queryAll();
  </code></pre>
  
  <p>in php but not working.
  So please anyone help to solve this problem</p>