根据当前经纬度返回最近店铺距离 php

根据当前经纬度返回最近店铺距离

$lng = input('lng');    123开头

$lat = input('lat');        41~

$lists = Db::query("SELECT *,SQRT( POW(111.2 * (lat - ?), 2) +

POW(111.2 * (? - lon) * COS(lat / 57.3), 2)) AS distance FROM car_shop HAVING  shop_type like '%3%' and hide=1 and auditing=1 and balance is not null  ORDER BY distance,star_level desc limit 3 ",[$lat,$lon]);



where address LIKE CONCAT('%', ?,'%')     加模糊查询需要添加  CONCAT

你可能感兴趣的:(根据当前经纬度返回最近店铺距离 php)