//20位热门用户
$query = $_SGLOBAL['db']->query("SELECT s.*, sf.resideprovince, sf.residecity
FROM ".tname('space')." s
LEFT JOIN ".tname('spacefield')." sf ON sf.uid=s.uid
ORDER BY s.friendnum DESC LIMIT 0,20"); //通过好友数排序,取前20名
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$spacelist[] = $value;