title: How can i use function in my mysql query?
body: <p>I am working in php. </p>
  
  <p>i want to find out the places which are with in a given distance from a geographical latitude and longitude.</p>
  
  <p>i have one table in a mysql database called <strong>places</strong>, in which there are three columns <code>placeId</code>, <code>latitude</code> and <code>longitude</code>.</p>
  
  <p>user provide <code>latitude</code>, <code>longitude</code> of a place and a <code>distance</code>, then by using the following formula: </p>
  
  <blockquote>
    <p>d=2*asin(sqrt((sin((lat1-lat2)/2))^2 + 
                         cos(lat1)<em>cos(lat2)</em>(sin((lon1-lon2)/2))^2));</p>
  </blockquote>
  
  <p>i can check whether these place are with in the distance given by the user or not.</p>
  
  <p>I want to know that how can i write a query and function to implement this functionality.</p>