Adding to PHP if

Discussion in 'PHP' started by thecubehost, Feb 1, 2014.

  1. #1
    Hi Guys,

    I need help fixing this code. I need it to be true for when there is as value for $first_ad_top OR $second_ad_top. I tried the following but it didn't work.

    if (!empty($first_ad_top)) or (!empty($second_ad_top))
    Code (markup):

    Anyways, here the is the code I'm dealing with.
                <?php
                    $first = get_option('first');
                    $second = get_option('second');
                    if (!empty($first_ad_top)) {
    blabber blabber and the rest of the code
                    }
                ?>
    Code (markup):
     
    thecubehost, Feb 1, 2014 IP
  2. homer7

    homer7 Well-Known Member

    Messages:
    268
    Likes Received:
    25
    Best Answers:
    4
    Trophy Points:
    125
    #2
    if (!empty($first_ad_top) or !empty($second_ad_top)) {....}

    or

    if (!empty($first_ad_top) || !empty($second_ad_top)) {....}
     
    homer7, Feb 1, 2014 IP
  3. Nette

    Nette Active Member

    Messages:
    58
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    65
    #3
    Maybe something like that?
    <?php
    if ($first_ad_top == "Your value"){
    //Your code
    }
    ?>
    PHP:
     
    Nette, Feb 1, 2014 IP
  4. thecubehost

    thecubehost Active Member

    Messages:
    221
    Likes Received:
    6
    Best Answers:
    1
    Trophy Points:
    70
    #4
    Thanks! You guys are awesome. Problem solved.
     
    thecubehost, Feb 1, 2014 IP