Re: Impossible bug!
| From: | Mark | Date: | Thu, 26 Jun 2003 14:16:11 +0000 |
| Subject: | Re: Impossible bug! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-152989@lists.php.net to get a copy of this message | ||
In additon to the previous comment about resetting $*_color, you're
multiplying the decimal value by 100 to get a percentage. But then
you're comparing it to 1, not 100.
EWither don't multiply it by 100, or check to see if it's > 100. Or
do you really want $*_color to be set if it's greater than 1%?
--- John Wulff <johnw@orcasnet.com> wrote:
> Where the heck is my problem? No matter what the value for *_color
> is
> always 1!!!
>
> $example_data = array(
> array("Mar-99",100,2000,5945.33,1234,10),
> array("Feb-99",908,3454,47648.90,4321,50),
> array("Jan-99",542,8000,13365.52,6012,60)
> );
>
> $high = 47648.90;
> if(!isset($num))
> {
> $num = 1;
> }
> while($num <= 100 && $num >= 1)
> {
>
> foreach ($example_data as $key=>$value)
> {
> list($month, $a, $b, $c, $d, $e) = $value;
>
> $a_percent = ($a / $high) * 100;
> if($a_percent > $num) { $a_color = 1; }
>
> $b_percent = ($b / $high) * 100;
> if($b_percent > $num) { $b_color = 1; }
>
> $c_percent = ($c / $high) * 100;
> if($c_percent > $num) { $c_color = 1; }
>
> $d_percent = ($d / $high) * 100;
> if($d_percent > $num) { $d_color = 1; }
>
> $e_percent = ($e / $high) * 100;
> if($e_percent > $num) { $e_color = 1; }
> }
>
> $num = $num + 1;
> }
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
=====
Mark Weinstock
mark_weinstock@yahoo.com
***************************************
You can't demand something as a "right" unless you are willing to fight to death to
defend everyone else's right to the same thing.
***************************************
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com