You never set *_color back to 0 at any point, so the first time through
the loop it gets set to 1 and stays there.
Replace you lines like:
; if($a_percent > $num) { $a_color = 1; }
with:
$a_color = $a_percent > $num;
On Thu, 26 Jun 2003, John Wulff 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;
;
; $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
;
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php