How to check if data exists or not in database using mysqli and PHP reference by latitude and longitude?
test table
______________________________________________________________
|__id__|__langtitude_coolumn_name__|__lattitude_coolumn_name_|
|___1__|_______37.802924___________|______-98.448061_________|
|___2__|_______37.798518___________|______-98.459890_________|
|___3__|_______37.797262___________|______-98.454006_________|
I use this code for check data exist or not in database using mysqli and PHP reference by latitude and longitude less than 100 km from my location latitude = 37.799773
and longitude = -98.460878
But I not have any result, how can I do?
<?PHP
$lattitude_value= "37.799773";
$langtitude_value = "-98.460878";
$stmt = $db_mysqli->prepare("SELECT U.* FROM table_name WHERE st_distance_sphere( POINT(U.langtitude_coolumn_name, U.lattitude_coolumn_name), POINT(?, ?)) <= 100000");
$stmt->bind_param("ss", $langtitude_value, $lattitude_value);
$stmt->execute();
$arr = $stmt->get_result()->fetch_all(MYSQLI_ASSOC);
if(!$arr)
{
echo "not have data";
}
else
{
echo "get data";
}
?>