Sorting after count statistics & lt ;? $ SQL = $ empire-& gt; query (& quot; selectuserid, usernamefrom {$ dbtbpre} enewsmemberwheregroupid = 1 andchecked = 1 & q count sorting after statistics
$ 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;
}
?>
How to sort by $ num in descending order
------ Solution --------------------
To #8 php already provides powerful functions. why not?
PHP code
$ Arr ['uid'] = array (1, 3, 4, 5, 6); $ arr ['name'] = array ('A1', 'A2 ', 'A3 ', 'A4 ', 'a5', 'a6 '); $ arr ['num'] = array (, 60, 10,); array_multisort ($ arr ['num'], $ arr ['name'], $ arr ['uid']); print_r ($ arr );