Jump to content

array problem


tom_b

Recommended Posts

I run a couple of queries and end up the following results (this part works fine):

 

      $values['ed']['sum']  = mysql_result($result, 0, "ed");

      $values['ted']['sum'] = mysql_result($result, 0, "ted");

      $values['tom']['sum'] = mysql_result($result, 0, "tom");

 

      $values['ed']['name'] = mysql_field_name($result, 0);

      $values['ted']['name'] = mysql_field_name($result, 1);

      $values['tom']['name'] = mysql_field_name($result, 2);

 

the following cold puts the "sum" data into an array and sorts it:

 

      $edsum = $values['ed']['sum'];

      $tedsum = $values['ted']['sum'];

      $tomsum = $values['tom']['sum'];

 

        $temp = array("$edsum", "$tedsum", "$tomsum");

              array_multisort($temp, SORT_NUMERIC, SORT_DESC);

              foreach ($temp as $element)

      echo "$element<br>";

 

it all works fine, but I want to get the "name" data into the array as well (or somehow get the "names" into the "sum" variables) so I can output each name with the sorted data.  Nothing I've tried seems to even come close, I'd appreciate any ideas!!! 

 

Thanks, Tom

Link to comment
https://forums.phpfreaks.com/topic/39108-array-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.