Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jan 2004
    Posts
    245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    AND.....stupid question

    why doesn't this work?

    PHP Code:
    ((!empty($cuisine_List)) && (empty($districts_List))) 
    I know for "OR" this is the way to write it "||" what about for "AND"?

  • #2
    New Coder
    Join Date
    Aug 2005
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #3
    Regular Coder
    Join Date
    Jan 2004
    Posts
    245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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....

  • #4
    New Coder
    Join Date
    Aug 2005
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Did you write that backwards to what you want, because you have the ! at the wrong one. But I tested this:
    PHP Code:
    <?php

    $name 
    "";
    $bla "asas";

    if ((empty(
    $name)) && (!empty($bla)))
    {
        echo 
    "correct";
    } else {
        echo 
    "incorrect";
    }
    ?>
    which gave the result correct. So I know it works right.

  • #5
    Senior Coder
    Join Date
    Feb 2003
    Location
    Ontario, Canada
    Posts
    1,223
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •