Re: Seems Simple enough
| From: | Christopher J. Crane | Date: | Mon, 26 Jan 2004 16:56:23 +0000 |
| Subject: | Re: Seems Simple enough | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-175783@lists.php.net to get a copy of this message | ||
Ok here is the wierd thing.
I pasted more code, it seems to not work because of me changing the number
format.
This works ...
if($Balance >= 10001) {
$Balance = number_format($Balance,2,'.',',');
echo "<font color=\"green\">\$$Balance</font><br>\n"; }
if($Balance <= 9999) {
$Balance = number_format($Balance,2,'.',',');
echo "<font color=\"red\">\$$Balance</font><br>\n"; }
else {
$Balance = number_format($Balance,2,'.',',');
echo "<font color=\"purple\">\$$Balance</font><br>\n"; }
This does not ...
$SummaryResults = mysql_query("SELECT * FROM Accounting WHERE
UserID='$UserID' LIMIT 1") or die("Invalid query");
while($SummaryField = mysql_fetch_array($SummaryResults)) {
$Balance = number_format($SummaryField["Balance"],2,'.',',');
}
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";
}
"Stuart" <lists@sharedserver.net> wrote in message
news:401542D2.2090600@sharedserver.net...
> Christopher J. Crane wrote:
> > 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"; }
>
> Works fine here. The elseif condition will be true if $Balance is
> undefined. Are you sure that variable exists and is actually set to 10000?
>
> --
> Stuart