ok what i am trying to do is math between different values and then echo something if that number is in between those values

//gives %
			  $bal = $other / $first + $second + $third; 

//checks what percent is in between
			  if($bal < 50) {
				  echo "3pt";
			  }
//if below 50
			  if(51 < $bal && $bal < 75) {
				  echo "2pt";
			  }
//if above 51 and below 75
				  if(76 < $bal && $bal < 100) {
				  echo "1pt";
			  }
//if above 76 and below 100
				  
			  echo $bal;

now that is what i got. but i know the value is 51 and yet it doesn't echo 2pt. what am i doing wrong? the below 50 works but the others don't

thanks

if(51 < $bal && $bal < 75)

This statement reads "if $bal is GREATER THAN 51 and LESS THAN 75". If you have $bal EQUAL to 51 it is not GREATER THAN 51. (Sorry for the shouting, but it is necessary to emphasise my point).

What you need is this:

if( $bal >= 51 && $bal < 75)

Similar for the rest...

thanks. im not really a math person. haha. and i just learning how to do math in php for the first time. good thing it is easy.

thanks again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.