21,886
社区成员
发帖
与我相关
我的任务
分享
function getdistricts($distid = 0, $distids) {
global $_SGLOBAL;
if (empty ($distids)) $distids = $distid;
$sql = "select * from " . tname('district') . " where reid=$distid";
$query = $_SGLOBAL['db']->query($sql);
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$distids = $distids . "," . $value['id'];
echo $distids."<br>";
return getdistricts($value['id'], $distids);
}
return $distids;
}
function getdistricts($distid = 0, $distids) {
global $_SGLOBAL;
if (empty ($distids)) $distids = $distid;
$sql = "select * from district where parentid=$distid";
$query = $_SGLOBAL['db']->query($sql);
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$distids = $distids . "," . $value['id'];
echo $distids."<br>";
return getdistricts($value['id'], $distids);
}
return $distids;
}