在查询期间尝试计算距离时出现问题。 计算“AS距离” 由于某些原因,我的“距离”反映了几个结果的完全相同......当纬度和经度非常不同时。
$result2 = mysqli_query($datacon,"SELECT spreadsheet.*,zipcode, ( 3956 * acos( cos( radians( '$lat_A' ) ) * cos( radians( location_latitude ) ) * cos( radians( location_longitude ) - radians( '$long_A' ) ) + sin( radians( '$lat_A' ) ) * sin( radians( location_latitude ) ) ) ) AS distance
FROM spreadsheet,craft_zipcodes
WHERE
spreadsheet.ZIP=craft_zipcodes.zipcode
and spreadsheet.package='$package'
and spreadsheet.HIDE_FROM_SEARCH = '0' and spreadsheet.googlezero = '0' GROUP BY ADDRESS HAVING distance <= $radius ORDER BY distance asc $pages->limit ");
如果您从分页中选择“全部”..您可以看到每20-30行会显示不同的距离?我不知道为什么......