//Create array while($array2 = mysql_fetch_array($result2)) { $VoteArray[] = array('photo' => $array2['photo'], 'member' => $array2['member'], 'category' => $array2['category'], 'avg_vote' => $array2['AVG(vote)'], 'vote_nr' => $array2['COUNT(vote)']); } //Reorder $VoteArray so that the element with the highest 'avg_vote' value comes first $test = array('avg_vote');//sort criteria array_multisort($test,SORT_DESC,$VoteArray); print_r($VoteArraySorted); //Doesnt'work. What the hell should i do?