--- "Ford, Mike [LSS]" <[EMAIL PROTECTED]> wrote:
> > -----Original Message-----
> > From: Mark [mailto:[EMAIL PROTECTED]
> > Sent: 26 June 2003 15:16
> > To: John Wulff; [EMAIL PROTECTED]
> > Subject: Re: [PHP] Impossible bug!
> >
> >
> > 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%?
>
> Actually, if you look really carefully, you'll see he's comparing
> it
> successively to every integer between the initial value of $num (or
> 1 if it
> wasn't set) and 100 -- but as he's never remembering these, all
> he'll get
> out of this is whether the percentages are greater then one of
> these values
> (which, if the loop starts at 1, it's more then likely they all
> will be!).
Very true. I didn't look carefully enough at the code.
>
> Mind you, if this is a snip of the real script and there's some
> output
> making use of these values each time round the loop, this may
> actually be
> what's required. ;)
I would hope something else is happening. It'd be a pretty boring
application otherwise! ;^)
>
> Cheers!
>
> Mike
>
>
---------------------------------------------------------------------
> Mike Ford, Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Beckett Park, LEEDS, LS6 3QS, United Kingdom
> Email: [EMAIL PROTECTED]
> Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
>
>
> > --- John Wulff <[EMAIL PROTECTED]> 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
[EMAIL PROTECTED]
***************************************
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php