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

count统计后的排序有关问题

Jun 13, 2016 pm 01:06 PM
arr array quot

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
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

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Sort array using Array.Sort function in C# Sort array using Array.Sort function in C# Nov 18, 2023 am 10:37 AM

Sort array using Array.Sort function in C#

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决

Simple and clear method to use PHP array_merge_recursive() function Simple and clear method to use PHP array_merge_recursive() function Jun 27, 2023 pm 01:48 PM

Simple and clear method to use PHP array_merge_recursive() function

How to use the array_combine function in PHP to combine two arrays into an associative array How to use the array_combine function in PHP to combine two arrays into an associative array Jun 26, 2023 pm 01:41 PM

How to use the array_combine function in PHP to combine two arrays into an associative array

Detailed explanation of PHP array_fill() function usage Detailed explanation of PHP array_fill() function usage Jun 27, 2023 am 08:42 AM

Detailed explanation of PHP array_fill() function usage

How to use the Array module in Python How to use the Array module in Python May 01, 2023 am 09:13 AM

How to use the Array module in Python

What are the common causes of ArrayStoreException in Java? What are the common causes of ArrayStoreException in Java? Jun 25, 2023 am 09:48 AM

What are the common causes of ArrayStoreException in Java?

Introduction to how to use the PHP array_change_key_case() function Introduction to how to use the PHP array_change_key_case() function Jun 27, 2023 am 10:43 AM

Introduction to how to use the PHP array_change_key_case() function

See all articles