|
Posted by Geoff Berrow on 10/25/05 13:26
A waste of electrons? You decide, but Message-ID:
<1h4zkrs.19pfkqd1sjz9uqN%hidden@mail.zz> from Ja NE contained the
following:
> $made = sprintf("%.f", $used / $total * 100);
>
Arrays are easy and incredibly useful
Try something like:
//create an array using the id as the key and %age as value
$made[$id]=$used / $total * 100;
in your while loop.
Sort the array in reverse order
arsort($made);
and outside the loop echo it to the screen
foreach ($made as $key=>$value){
echo $key." @ ".number_format($value,2)."%<br>";
}
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Navigation:
[Reply to this message]
|