Jump to content


comparrison problem

  • Please log in to reply
1 reply to this topic

#1 jayR

  • Members
  • PipPip
  • Member
  • 26 posts

Posted 08 June 2006 - 06:14 PM

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

#2 litebearer

  • Members
  • PipPipPip
  • Advanced Member
  • 2,357 posts
  • Locationwhite lake michigan

Posted 08 June 2006 - 07:11 PM

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

all the brothers were valiant!

[br][br]The truely intelligent people are not those who create the dots; rather they are they ones with the ability to connect the dots into a coherent picture

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users