function checkIsSet($name, $db)
{
    $sql = 'SELECT city_id, region_id' . ' FROM ru_eyezeek.vehicles' . ' WHERE city_id IS NOT NULL AND region_id IS NOT NULL AND l_geo_city= :l_geo_city' . ' LIMIT 1';
    $stmt = $db->prepare($sql);
    $stmt->bindParam(':l_geo_city', $name, PDO::PARAM_STR);
    $res = $stmt->execute();
    if ($res === false) {
        print_r($stmt->errorInfo());
        die;
    }
    $row = $stmt->fetch();
    $stmt->closeCursor();
    if ($row === false) {
        return false;
    } else {
        updateAds($name, $row['city_id'], $row['region_id'], $db);
        return true;
    }
}
function checkIsSet($name, $old_region_id, $db)
{
    if (is_null($old_region_id)) {
        $regionIdSql = ' AND l_geo_region_id IS NULL';
    } else {
        $regionIdSql = ' AND l_geo_region_id="' . $old_region_id . '"';
    }
    $sql = 'SELECT city_id, subregion_id, region_id' . ' FROM ru_eyezeek.realestate' . ' WHERE city_id IS NOT NULL AND l_geo_city= :l_geo_city ' . $regionIdSql . ' LIMIT 1';
    $stmt = $db->prepare($sql);
    $stmt->bindParam(':l_geo_city', $name, PDO::PARAM_STR);
    $res = $stmt->execute();
    if ($res === false) {
        print_r($stmt->errorInfo());
        die;
    }
    $row = $stmt->fetch();
    $stmt->closeCursor();
    if ($row === false) {
        return false;
    } else {
        updateAds($name, $row['city_id'], $row['subregion_id'], $row['region_id'], $old_region_id, $db);
        return true;
    }
}