title: Rearrange data before printing
body: <p>I currently have code that pulls data from a db, then does some math on part of it, and then prints it to a table. However, I would like to arrange the numbers printed from larges down to smallest. I'm familiar with ordering in the query, however the query doesn't know what the end result will be. What would be the most efficient way to go about rearranging this data.</p>
  
  <pre><code>&lt;?php
      $hourAmount = $mlYeild * (3600 / $cycleTime);
      $oreVolumePriceQuery = "SELECT od.oreID, od.inGameID, od.size, ir.officialCorpRate FROM oreData od JOIN itemRates ir ON od.inGameID = ir.typeID order by od.oreID asc";
      $oreVolumePriceResult = mysql_query($oreVolumePriceQuery);
  $hourYeild = $mlYeild * (3600 / $cycleTime);
  ?&gt;
  &lt;TABLE&gt;
      &lt;TR&gt;
          &lt;TD&gt;&lt;h1&gt;Ore&lt;/h1&gt;&lt;/TD&gt;
          &lt;TD&gt;&lt;h1&gt;Hourly Yeild&lt;/h1&gt;&lt;/TD&gt;
          &lt;TD&gt;&lt;h1&gt;Hourly Sale&lt;/h1&gt;&lt;/TD&gt;
      &lt;/TR&gt;
      &lt;?php
          $ores = array();
          While($row = mysql_fetch_assoc($oreVolumePriceResult)){
              $inGameID = $row['inGameID'];
              $volume = $row['size'];
              $rate = $row['officialCorpRate'];
              $name = $row['name'];
              $hourlyYeild = $hourAmount/$volume;
              $hourlyIncome = $hourlyYeild * $rate;
  
              echo "&lt;TR&gt;";
              echo "&lt;TD&gt;".$name."&lt;/TD&gt;";
              echo "&lt;TD&gt;".$hourlyYeild."&lt;/TD&gt;";
              echo "&lt;TD&gt;".$hourlyIncome."&lt;/TD&gt;";
              echo "&lt;/TR&gt;";
          }
      ?&gt;
  &lt;/TABLE&gt;
  </code></pre>
  
  <p>in short, from the data that comes in, I would like it to be arranged via <code>$hourlyIncome desc</code></p>