1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Help with 1 PHP line please.

Discussion in 'PHP' started by x0x, Jul 17, 2008.

  1. #1
    What I have:

    <?if($pmp['status'] == admin || $pmp['status'] == moderator){?>
         *message*?>
         <?}?>
    Code (markup):

    What I want:

      <?if($pmp['status'] == admin || $pmp['status'] == moderator AND $pimp['status'] == normal){?>
        *message*?>
         <?}?>
    Code (markup):
    (this is wrong, because it didn't work as I wanted)


    This didn't worked but what I tried to make was that *message* shows in 2 cases:

    case 1, when $pmp['status'] == admin

    case 2, when $pmp['status'] == moderator and $pimp['status'] == normal
     
    x0x, Jul 17, 2008 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    if ($pmp['status'] == 'admin' OR ($pmp['status'] == 'moderator' AND $pimp['status'] == 'normal'))
    
    PHP:
    ... use quotes around the strings (admin, moderator, normal), unless they're defined constants.
    And I added parenthesis, to group it. Give it a try.
     
    nico_swd, Jul 17, 2008 IP
  3. x0x

    x0x Well-Known Member

    Messages:
    510
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    110
    #3
    I couldn't get it to work. Could you add the full code with the openings and closings? I don't know much about php...

    Here is what i tried:

    
       <?if ($pmp['status'] == 'admin' OR ($pmp['status'] == 'moderator' AND $pimp['status'] == 'normal'))?>
      *message*
         <?}?>
         </p>
    Code (markup):
    The ending is wrong i think.
    I tried many and got errors like:
    Parse error: syntax error, unexpected '}'
    Parse error: syntax error, unexpected ')''

    etc...
     
    x0x, Jul 17, 2008 IP
  4. revvi

    revvi Peon

    Messages:
    58
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Try this :

    <?php 
    if (($pmp['status'] == 'admin') || (($pmp['status'] == 'moderator') && ($pmp['status'] == 'normal'))) {
    ?>
    <p>your html message here</p>
    <?php } ?>
    PHP:
     
    revvi, Jul 17, 2008 IP
  5. x0x

    x0x Well-Known Member

    Messages:
    510
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    110
    #5
    excellent. THANK YOU!
     
    x0x, Jul 17, 2008 IP
  6. Pricey

    Pricey Peon

    Messages:
    124
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    You had pimp instead of pmp.
     
    Pricey, Jul 17, 2008 IP
  7. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #7
    'Cause he got dem hoes.
     
    nico_swd, Jul 17, 2008 IP