note 25659 deleted from function.array-multisort by didou
| From: | didou@php.net | Date: | Fri, 24 Oct 2003 14:59:47 +0000 |
| Subject: | note 25659 deleted from function.array-multisort by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-59241@lists.php.net to get a copy of this message | ||
Note Submitter: dream_master@o2.pl
----
My problem:
query1
SELECT DISTINCT(ref) FROM $login WHERE ids LIKE '$what'
2nd query:
SELECT count(ref) FROM $login WHERE ids LIKE '$what' AND ref LIKE '$query1
In 1st query I ask mysql to give me unique ref values.
In 2nd query I am asking db to show me how many times each unique ref
You can put it in 2dimension array.
Array[how_many][ref_name]
I try to order this.... problem.
Let's do one dimension array
query1.";".query2
Now we have array like this
array[0]="3;http://yahoo.com"
array[1]="7;http://not.yahoo.com"
Now we can use array_multisort
array_multisort($array,SORT_NUMERIC, SORT_DESC);
Now we have sorted array. all you need now is to use explode() function.