PDA

View Full Version : PHP help



afcbob
02 Aug 2005, 05:02 PM
Hello i am learning php just now and am using a training course to learn.But i have a problem am trying to use the && but can't get it to work.
This is the code it say to use:

if (($a > 100) && ($a <2000)) {
echo "number is greater than 100 but less than 2000";
}

i have tried moving the $a values up and down but just can't get this to work.
Please help me out.

if i don't get it soon i will have no hair left at al

trueheart78
02 Aug 2005, 11:20 PM
What's the whole script that you are using? The reason I ask, is to me, this works fine.

Make sure $a has been assigned a value.

I used:

$a = 101;
if (($a > 100) && ($a <2000)) {
echo "Number is greater than 100 but less than 2000 ($a)";
} else {
echo "The value of \$a is $a";
}

and everything worked fine, I got the original output.

What do you get if you use an else like I did above with a different set of output?