jschofield Posted July 25, 2007 Share Posted July 25, 2007 Hello all, I have a file that has money balance's in it. What I am trying to do is format the file so that anything with a balance of .$.01 - $2.00 is named a "Low" balance. Everything with a $-.01 or less is a "Negitive" balance and the even ($0.00) balances will be thrown out. Below is what I have came up with so far but does not work of course. Can anyone help me please? This has been a drawn out deal for me and I just cant get it. Thanks for all the help everyone. I really appriciate it. Johnnie if (($vals[4] + 0) < 0) { $balancetype = "Negative"; $negcount ++; } else { $balancetype = "Low"; $lowcount ++; Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted July 25, 2007 Share Posted July 25, 2007 what is in $vals??? With the information you gave, I came up with this: <?php if($vals[4] >= .01 || $vals[4] <= 2){ $balancetype = "Low"; $negcount ++; }elseif($vals[4] < 0){ $balancetype = "Negative"; $negcount ++; } ?> Quote Link to comment Share on other sites More sharing options...
akitchin Posted July 25, 2007 Share Posted July 25, 2007 just some minor corrections/additions: <?php $lowcount = 0; $negcount = 0; $normcount = 0; $dropped = 0; if($vals[4] >= .01 || $vals[4] <= 2){ $balancetype = "Low"; $lowcount ++; }elseif($vals[4] < 0){ $balancetype = "Negative"; $negcount ++; }elseif($vals[4] == 0){ $balancetype = 'Zero'; $dropped++; }else{ $balancetype = 'Normal'; $normcount++; } ?> Quote Link to comment 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.