jayR Posted June 8, 2006 Share Posted June 8, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/11511-comparrison-problem/ Share on other sites More sharing options...
litebearer Posted June 8, 2006 Share Posted June 8, 2006 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 happensLite... Quote Link to comment https://forums.phpfreaks.com/topic/11511-comparrison-problem/#findComment-43343 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.