<?php
//根据小区名字找小区ID
require('path.inc.php');
//根据房源的小区名字进行精确匹配
$sql ="select * from  fke_houserent where borough_id = 0";
$query->open($sql);
$result = array();

while ($rs = $query->next()) {
	$borough_id = $query_mysql->getValue('select id from fke_borough where borough_name =\''.$rs['borough_name'].'\'');
	if($borough_id){
		$query_mysql->execute("update fke_houserent set borough_id='".$borough_id."' where id=".$rs['id']);
	}
}

//根据房源的小区名字进行模糊匹配
$sql ="select * from  fke_houserent where borough_id = 0";
$query->open($sql);
$result = array();

while ($rs = $query->next()) {
	$borough_id = $query_mysql->getValue('select id from fke_borough where isdel=0 and borough_name like \'%'.$rs['borough_name'].'%\'');
	if($borough_id){
		$query_mysql->execute("update fke_houserent set borough_id='".$borough_id."' where id=".$rs['id']);
	}
}

//根据房源的小区名字进行模糊匹配
$sql ="select * from  fke_borough where isdel=0";
$query->open($sql);
$result = array();

while ($rs = $query->next()) {
	$query_mysql->execute("update fke_houserent set borough_id='".$rs['id']."' where borough_id=0 and borough_name like '%".$rs['borough_name']."%'");
}

print_r("更新完成");
exit;
?>