While searching on the internet for a few hours I found that there are several ways of calculating the distance between 2 geo points, and getting the distance in different units. However I didn't really find the explanation for what I'm looking for.
In my androind project I have a LocationService which upon onLocationChanged
UPDATE's the users table with a new latitude and longitude within the logged in users row.
But what I need now is to upon the UPDATE to also Query for users which are within a certain distance from my UPDATED Location. Obviously I want to search/query for the users in php, and then return the data to the logged in user. The code which I currently have is listed below.
How can I query for all users within a certain distance (in meters) and return them into a list in Android?
if (!$con) {
die("Not connected : " . mysql_error());
}
$latitude1 = $_POST["Latitude"];
$longitude1 = $_POST["Longitude"];
$username = $_POST["Username"];
$updatequery = mysqli_prepare($con , "UPDATE users SET Latitude = ?, Longitude = ? WHERE Username = ?");
mysqli_stmt_bind_param($updatequery ,"dds",$latitude1,$longitude1,$username);
mysqli_stmt_execute($updatequery);
mysqli_stmt_close($updatequery);
mysqli_close($con);