Jump to content

comparrison problem


jayR

Recommended Posts

Hi all,

I'm working on, what I thought would be, an easy problem. Its simply an if statement that checks if a value is greater than 1000. However, its not picking anything up and I'm running out of time for this project. My problem code is as follows...


//$AmtOfAdj is set from our database, and I've printed out its values so I know its getting the right values
$AmtOfAdj = number_format($commaFile[$i] * .01, 2);
settype($AmtOfAdj, "float");

if($AmtOfAdj > 1000.00)
{
print $AmtOfAdj . "<br />";
}

I have no idea why its doing this, but I'm stuck so if anyone could help me out I'd appreciate it.

Thanks a lot
Link to comment
Share on other sites

I could be mistaken; but when you use the number format to place a 'value' into a variable, that variable is treated as a string NOT a numerical value. Suggest you use the number formating AFTER you have done all your math.


Try adding 3 to your variable and echo it, see what happens
Lite...
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.