Hello guys
I came acrross with some information to display my database results given latitude and longitude values and sort it by distance
so far it works good but I was wondering how could i echo the actual distance between starting point and my results?
my database is pretty straight forward: id, username, lat (latitude), lng (longitude) and a couple more things that will not be used right now....
the sql request code:
$find = mysql_query("SELECT username, lat, lng, SQRT(
POW(69.1 * (lat - '".$latitude."'), 2) +
POW(69.1 * ('".$longitude."' - lng) * COS(lat / 57.3), 2)) AS distance
FROM users WHERE username != '".$usern."' HAVING distance >= 0 ORDER BY distance ASC");
while($row = mysql_fetch_array($find))
{
echo "<br />".$row['username'];
}
$latitude and $longitude is the current logged in member's location information
so, I would like to know how to echo the actual distance in miles???
so i could do something like :
echo $username."" is ".$distance." mile(s) from you...";
Thanks in advance!