RE: [PHP] Seems Simple enough

2004-01-27 Thread Ford, Mike [LSS]
On 26 January 2004 16:56, Christopher J. Crane wrote: > 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 "\$$Balance\n"; }

Re: [PHP] Seems Simple enough

2004-01-26 Thread Christopher J. Crane
Ok the problem seems to me, the format. I think that once I have the format changed to include a comma seperation for thousands. I think at that point, it is no longer a true number, so PHP deals with it differently. "Christopher J. Crane" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]

Re: [PHP] Seems Simple enough

2004-01-26 Thread Stuart
Christopher J. Crane wrote: To the original problem, it all hinges on me changing the format of $Balance. If I remove the line " $Balance = number_format($SummaryField["Balance"],2,'.',','); " and replace it with " $Balance = $SummaryField["Balance"]; " it works fine. Well, duh! If you add periods

Re: [PHP] Seems Simple enough

2004-01-26 Thread Christopher J. Crane
Good Question on the looking though all rows. I never wrote code looking at just that one code and getting the variable from the column. That is why I limited the query to one "LIMIT 1". I guess it is just me pasting code from my other applications and not checking it out. To the original problem,

Re: [PHP] Seems Simple enough

2004-01-26 Thread Stuart
Christopher J. Crane wrote: 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,'.',','); } Dis

Re: [PHP] Seems Simple enough

2004-01-26 Thread Christopher J. Crane
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 "\$$Balance\n"; } if($Balance <= ) { $Balance = number_format($Balance,2,'.',',');

RE: [PHP] Seems Simple enough

2004-01-26 Thread Larry Brown
you need one of the to if's to be either $Balance >=1 elseif($Balance < 1000) or $Balance > 1 elseif($Balance <= 1). Yours has the first saying everything equal to or greater than 10001 which 1 is not else everything less than or equal to which 1 is not. =) Larry -Or

Re: [PHP] Seems Simple enough

2004-01-26 Thread Stuart
Christopher J. Crane wrote: if($Balance >= 10001) { echo "\$$Balance\n"; } elseif($Balance <= ) { echo "\$$Balance\n"; } else { echo "\$$Balance\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 1?