Hi, I have 2 variables created from the result of a mysql query.
For each row there is a scalar $state and $number. I need to be able to push them into an array, say $States, and sort it by $number. I would like to arrange them in descending order with the state with the highest number being first.
What is happening though is they are going into an array, but as one long element instead of seperate items and their keys.
Here is my code:
while ($row = mysql_fetch_row($result)) {
$state = $row[0];
$number = $row[1];
$States = array($state=>$number);
arsort($States);
reset($States);
$HowMany = count($States);
print "Number of elements = $HowMany\n";