Re: [PHP-DB] Array sorting question...

2004-01-23 Thread Kelly Hallman
On Fri, 23 Jan 2004, NIPP, SCOTT V (SBCSI) wrote: > I am trying to populate an array from a MySQL database. I think I > have the code correct to populate the array, but I need to somehow sort the > array eliminating duplicate values. I think I can loop through the array > doing a compariso

RE: [PHP-DB] Array sorting question...

2004-01-23 Thread Katie Evans-Young
NIPP, SCOTT V (SBCSI) wrote: > I am trying to populate an array from a MySQL database. I think I > have the code correct to populate the array, but I need to somehow > sort the array eliminating duplicate values. I think I can loop > through the array doing a comparison and building a new a

Re: [PHP-DB] array sorting

2002-11-12 Thread Ignatius Reilly
Just loop through the first index, then search on the second index: while ( list( $key, $value ) = each( $my_arr ) ) { // now $value is your ( [0] => 10 [1] => 40 [2] => 50 [3] => 80 [4] => 130 [5] => 220 [6] => 320 ) array // sort your array by values sort( $value ) ; // get the