PHP/MySQL: Select locations close to a given location from DB

后端 未结 7 1541
隐瞒了意图╮
隐瞒了意图╮ 2021-02-02 03:15

In PHP, I have the following code for calculating the distance between two locations:



        
7条回答
  •  余生分开走
    2021-02-02 03:59

    MySQL has the ability to index rows geospatially. You might not need to do this math by yourself (you can just ask MySQL to compute the distance between two geo objects and sort by that..).

    See: http://forums.mysql.com/read.php?23,159205,159205

提交回复
热议问题