Home > Backend Development > PHP Tutorial > count统计后的排序有关问题

count统计后的排序有关问题

WBOY
Release: 2016-06-13 10:57:16
Original
1029 people have browsed it

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);<div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template