you need one of the to if's to be either $Balance >=10000 elseif($Balance <
1000) or $Balance > 10000 elseif($Balance <= 10000).  Yours has the first
saying everything equal to or greater than 10001 which 10000 is not else
everything less than or equal to 9999 which 10000 is not. =)

Larry

-----Original Message-----
From: Christopher J. Crane [mailto:[EMAIL PROTECTED]
Sent: Monday, January 26, 2004 11:29 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Seems Simple enough


I have these lines of code, that I thought was simple enough, but it doesn't
work how I thought.
The Variable $Balance is set to 10000 in the database, and I thought it
would be outputed as purple or the be found true of the "else" part of the
code. It comes out as red or the "elseif" part of the code.

 if($Balance >= 10001) { echo "<font
color=\"green\">\$$Balance</font><br>\n"; }
 elseif($Balance <= 9999) { echo "<font
color=\"red\">\$$Balance</font><br>\n"; }
 else { echo "<font color=\"purple\">\$$Balance</font><br>\n"; }

I originally had it as follows, but that didn't work either.

 if($Balance > 10000) { echo "<font
color=\"green\">\$$Balance</font><br>\n"; }
 elseif($Balance < 10000) { echo "<font
color=\"red\">\$$Balance</font><br>\n"; }
 else { echo "<font color=\"purple\">\$$Balance</font><br>\n"; }

--
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

Reply via email to