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

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?

[PHP] Seems Simple enough

2004-01-26 Thread Christopher J. Crane
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 1 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 c