[FX.php List] Creating summaries on the fly,

Bob Patin bob at patin.com
Tue Aug 22 21:53:28 MDT 2006


But Steve, I can't do that until I know the value of the total. It  
works like this:

Ford Taurus= 3
Ford Focus = 4

Total # of Fords: 7

Honda Accord = 5
Honda CRX = 10

Total # of Hondas: 15

Total cars: 22

So next to the 3, I need 42.8%; next to 4, I need 57.1%

Next to 5, I need 33.3%, and next to 10, I need 66.7%

So I can't supply the percentages until i know how much the  
subsummary is. I can put percentages next to the SUBSUMMARY because  
it's based on the # of total vehicles, which I can get from my  
foundcount... but the subsummary values I can't get until the foreach  
runs its course...

That's why I'm thinking I need to refresh some variables in the table  
AFTER the foreach has finished.

Bob


On Aug 22, 2006, at 10:41 PM, Steve Winter wrote:

> Rather than outputting the results direct to the HTML page, why not  
> store
> them in an array using PHP, thus;
>   $cars['type1'] = 5;
>   $cars['type2'] = 10;
>   $cars....
> then you could output the data, and create the % as you go;
>   foreach($cars as $key = $value)
>     echo $key.' = '.$value.(($value / $counter) * 100).'%';
>
> You'll want to do some rounding on your percentages, but this  
> should be
> able to do what you want...?
>
> Let me know if I've missed something..

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20060822/c4777181/attachment.html


More information about the FX.php_List mailing list