View Full Version : AND.....stupid question

09-23-2005, 03:20 AM
why doesn't this work?

((!empty($cuisine_List)) && (empty($districts_List)))

I know for "OR" this is the way to write it "||" what about for "AND"?

09-23-2005, 03:32 AM
I'm new, so I could be wrong but, you are writing AND right (&&). But to my understanding you are saying if the first one is not empty and the second one is empty. If you want both to be not empty, move the ! "(!(" or add a second ! to the other empty. But not sure what isn't working?

09-23-2005, 03:40 AM
that's what i want, if the first one is empty and the second isnt....it's as if how im writing this is the wrong way....

09-23-2005, 03:50 AM
Did you write that backwards to what you want, because you have the ! at the wrong one. But I tested this:

$name = "";
$bla = "asas";

if ((empty($name)) && (!empty($bla)))
echo "correct";
} else {
echo "incorrect";

which gave the result correct. So I know it works right.

09-23-2005, 03:51 AM
if (empty ($cuisine_List) && !empty ($districts_List))
// First is empty. Second isn't.

Not sure how it differs from yours. I didn't really look at yours. Just read what you wanted :)