switch ($unit) { /*** miles ***/ case 'm': $unit = 3963; break; /*** nautical miles ***/ case 'n': $unit = 3444; break; default: /*** kilometers ***/ $unit = 6371; }$sql = "SELECT name, club_id, latitude,longitude, ( ". $unit . " * ACOS( COS( RADIANS( " . $latitude. ") ) * COS( RADIANS( latitude ) ) * COS( RADIANS( longitude ) - RADIANS( ". $longitude. ") ) + SIN( RADIANS(".$latitude.") ) * SIN( RADIANS( latitude ) ) ) ) AS distance FROM clubs HAVING distance < ".$distance." ORDER BY distance";
沒有留言:
發佈留言