【发布时间】:2014-05-09 16:13:43
【问题描述】:
我在 mysql 数据库 my_db 中有表 GPS_tbl。在GPS_tbl 中有四列1)uid2)latitude3)longitude4)regid。在2)latitude3)longitude 列中latitude 和longitude 的不同值已经存储为浮点数,现在我想要的是当用户通过POST() 发送他/她的gps coordinates in terms of latitude and longitude 时将这些用户发送的坐标与已经存储的坐标进行比较列中的坐标2)latitude3)longitude 和列中的坐标2)latitude3)longitude 最接近用户发送的坐标选择regid 反对它。请有人在php 中帮助我如何做到这一点。
这就是用户发送他/她的 GPS 坐标的方式。
$lati = $_POST['lati'];
$longi = $_POST['longi'];
$float_value_of_lati = floatval($lati);
$float_value_of_longi = floatval($longi);
这是GPS_tbl
+--------------+------------+-------------+-------------+
| uid | latitude | longitude | regid |
+--------------+------------+-------------+-------------+
| 1 | 73.3433 | 18.5223 |APA91W-ClDoS |
| | | | |
+--- ----------+------------+-------------+-------------+
| 2 | 43.3433 | 24.5523 |BON91W-ClDoS |
| | | | |
+--- ----------+------------+-------------+-------------+
| 3 | 55.3433 | 37.5323 |WCD71P-ClDoS |
| | | | |
+--- ----------+------------+-------------+-------------+
【问题讨论】:
标签: php mysql gps coordinates