日期:2014-05-17  浏览次数:20543 次

count统计后的排序问题
<?
$sql=$empire->query("select userid,username from {$dbtbpre}enewsmember where groupid=1 and checked=1");
while($ur=$empire->fetch($sql))
{
  $num=$empire->gettotal("select count(*) as total from phome_ecms_news where checked=1 and ismember=1 and userid='$ur[userid]'");
  echo $ur['userid'].$ur['username'].$num;
}
?>

如何接照$num降序排序

------解决方案--------------------
to #8 php 已经提供了强大的函数,为什么不用?
PHP code
$arr['uid'] = array(1,2,3,4,5,6);
$arr['name'] = array('a1','a2','a3','a4','a5','a6');
$arr['num'] = array(5,50,60,10,66,44);
array_multisort($arr['num'], $arr['name'], $arr['uid']);
print_r($arr);