Php 在3 km无线电距离下未显示正确的食物关联数据
我有一个包含食物关联数据的表,其中包含了它们的纬度和经度 我正在使用这个查询Php 在3 km无线电距离下未显示正确的食物关联数据,php,mysql,Php,Mysql,我有一个包含食物关联数据的表,其中包含了它们的纬度和经度 我正在使用这个查询 $q = "SELECT ( (ACOS(SIN( ".$userLatitude." * PI() / 180) * SIN(foodjoint_latitude * PI() / 180) + COS(".$userLongitude." * PI() / 180) * COS(foodjoint_longitude * PI() / 180) * COS((foodjoint_lon
$q = "SELECT (
(ACOS(SIN( ".$userLatitude." * PI() / 180) * SIN(foodjoint_latitude * PI() / 180) + COS(".$userLongitude." * PI() / 180) * COS(foodjoint_longitude * PI() / 180) * COS((foodjoint_longitude - ".$longitude.") * PI() / 180)) * 180 / PI()) * 60 * 1.1515 * 1.609344) AS distance
, foodjoint_id
, foodjoint_name
, open_hours
, cont_no
, AVG(customer_ratings) AS rating
, address_line
, city
FROM provider_food_joints,customer_review HAVING distance <=3";
$q=“选择(
(ACOS(SIN(“.$userlation.”*PI()/180)*SIN(foodjoint_lation*PI()/180)+COS(“.$userLongitude.”*PI()/180)*COS(foodjoint_lation*PI()/180)*COS((foodjoint_lation-“$longitude.”)*180/PI())*60*1.1515*1.609344)作为距离
,foodjoint_id
,foodjoint_name
,开放时间
,续
,作为评级的平均值(客户评级)
,地址线
城市
我在我的一个项目中发现了一些代码,但我不确定距离的计算。你应该改进你的连接
但是..什么是表连接
$q = "SELECT (
(
(
ACOS(
SIN(".$userLatitude." * PI() / 180) *
SIN(foodjoint_latitude * PI() / 180) +
COS(".$userLatitude." * PI() / 180) *
COS(foodjoint_latitude * PI() / 180) *
COS(
(".$userLongitude." - foodjoint_longitude) * PI() / 180)
) *
180 / PI()
) * 60 * (1.1515*1.609344)
) AS distance
, foodjoint_id
, foodjoint_name
, open_hours
, cont_no
, AVG(customer_ratings) AS rating
, address_line
, city
FROM provider_food_joints,customer_review
HAVING distance < 4";
$q=“选择(
(
(
ACOS(
SIN(“.$userLatitude.”*PI()/180)*
SIN(食物联合纬度*PI()/180)+
COS(“.$userLatitude.*PI()/180)*
COS(食物联合纬度*PI()/180)*
因为(
(“$userLongitude.”-foodjoint_longitude)*PI()/180)
) *
180/PI()
) * 60 * (1.1515*1.609344)
)作为距离
,foodjoint_id
,foodjoint_name
,开放时间
,续
,作为评级的平均值(客户评级)
,地址线
城市
来自供应商、食品、接头、客户审查
距离<4”的;