当前位置: 代码迷 >> PHP >> count统计后的排序有关问题
  详细解决方案

count统计后的排序有关问题

热度:147   发布时间:2012-11-07 09:56:10.0
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); 
  相关解决方案