$ere['lng'] = array('between',array($lng-1,$lng+1)); $ere['lat'] = array('between',array($lat-1,$lat+1)); $str = "ROUND(6378.138 * 2 * ASIN(SQRT(POW(SIN(($lat* PI() / 180 - lat * PI() / 180) / 2), 2) + COS($lat* PI() / 180) * COS(lat * PI() / 180) * POW(SIN(($lng* PI() / 180 - lng * PI() / 180) / 2), 2))) * 1000) AS distance"; $order = "distance ASC";