Google商店定位器错误..比半径更远的条目

https://developers.google.com/maps/articles/phpsqlsearch_v3

I am using Google's tutorial to create a store locator. I've finished building the store locator but there is a problem after testing when I search a store with a 25 mile radius it pulls in a store completely across the united states that is definitely further than 25 miles. Has anyone experienced this bug and/or have a recommendation on how to fix this issue?

for example, see this picture. the zip is from CT but pulls in a store from CA. enter image description here

javascript:

function searchStores(lat, lng) {
var url = '/store-finder/V3/includes/store-ajax.php';
var radius = $('#radiusSelect').val();
var prod = $('#myproducts').val();
//console.log("inside searchStores radius: " + radius);
//console.log("inside searchStores Product: " + prod);
var parameter = { lat: lat, lng: lng, radius: radius, prod: prod };
jQuery.ajax({
    url: url,
    data: parameter,
    dataType: 'json',
    success: showStores,
     error: function(xhr, status, error) {
          var err = eval("(" + xhr.responseText + ")");
          alert(err.Message);
        }

});
//console.log(parameter);
}

php:

$query = sprintf("SELECT 
        store_id, 
        store_name, 
        address1, 
        city, 
        state, 
        zip, 
        phone, 
        product_type.product_type_id, 
        coord_lat, 
        coord_long, 
        ( 3959 * acos( cos( radians('%s') ) * cos( radians( coord_lat ) ) * cos( radians( coord_long ) - radians('%s') ) + sin( radians('%s') ) * sin( radians( coord_lat ) ) ) ) AS distance 
    FROM 
        stores, stores_product_type_link, product_type, stores_store_type_link, store_type 
    WHERE 
        stores_product_type_link.csid = stores.csid 
        AND (stores_product_type_link.product_type_id = '%s' OR stores_product_type_link.product_type_id = '%s') 
        AND stores_product_type_link.product_type_id = product_type.product_type_id 
        AND stores_store_type_link.csid = stores.csid 
        AND stores_store_type_link.store_type_id = store_type.store_type_id 
    HAVING 
        distance < '%s' 
    ORDER BY 
        distance",
mysql_real_escape_string($lat),
mysql_real_escape_string($lng),
mysql_real_escape_string($lat),
mysql_real_escape_string($product),
mysql_real_escape_string($product2),
mysql_real_escape_string($radius));

$querystring = "SELECT 
        store_id, 
        store_name, 
        address1, 
        city, 
        state, 
        zip, 
        phone, 
        product_type.product_type_id, 
        coord_lat, 
        coord_long, 
        ( 3959 * acos( cos( radians('$lat') ) * cos( radians( coord_lat ) ) * cos( radians( coord_long ) - radians('$lng') ) + sin( radians('$lat') ) * sin( radians( coord_lat ) ) ) ) AS distance 
    FROM 
        stores, stores_product_type_link, product_type, stores_store_type_link, store_type 
    WHERE 
        stores_product_type_link.csid = stores.csid 
        AND (stores_product_type_link.product_type_id = '$product' OR stores_product_type_link.product_type_id = '$product2') 
        AND stores_product_type_link.product_type_id = product_type.product_type_id 
        AND stores_store_type_link.csid = stores.csid 
        AND stores_store_type_link.store_type_id = store_type.store_type_id 
    HAVING 
        distance < '$radius' 
    ORDER BY 
        distance";

$result = mysql_query($query); 
if (! $result)  
die_with_error(mysql_error()); 
$result_array = array(); 
while ($row = mysql_fetch_assoc($result)) {  
$address2 = $row['city'] . ", " . $row['state'] . " " . $row['zip'];
array_push($result_array, array(
    "id" => $row['store_id'],
    "name" => $row['store_name'],
    "address1" => $row['address1'],
    "address2" => $address2,
    "phone" => $row['phone'],
    "product_type_id" => $row['product_type_id'],
    "lat" => $row['coord_lat'],
    "lng" => $row['coord_long'],
    "distance" => round($row['distance'], 2),
    "qry" => $querystring
    ));
}

form input:

<label class="radius" style="display:none"><h3>Radius:</h3></label>
      <select id="radiusSelect">
        <option value="5" selected>5mi</option>
        <option value="10">10mi</option>
        <option value="25">25mi</option>
      </select>