Elric
Posts: 527/687 |
How would I go about ordering something after I already ordered it when I pulled it from the DB?
For example:
$things=mysql_query("SELECT stuff,crap FROM table ORDER BY stuff DESC LIMIT 0,5); while($thing=mysql_fetch_array($things) { $barf=$thing[stuff]-$thing[crap]; $list.="$barf"; }
This is where I get stuck. If the 5 values for stuff are, say 100,75,66,32, and 8 , and the 5 values for crap are 0,10,60,3, and 2 , then after you subtract those, the new values for stuff are now 100,65,6,29, and 5 . Since I initially ordered them by stuff , when I print $list to the screen, they'll show up in that order. But I want them to show up in their new descending order of 100,65,29,6, and 5 .
Is there a command to do this, or will I have to code a new function to do this? |