Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Feb 2008
    Posts
    291
    Tokens
    0

    Default What's wrong with this code?

    }if ($arr['rankpos'] == "1" || $arr['rankpos'] == "2" ||$arr['rankpos'] == "3" ||$arr['rankpos'] == "4" ||$arr['rankpos'] == "5" ||$arr['rankpos'] == "6" ||$arr['rankpos'] == "7" ||$arr['rankpos'] == "8" ||$arr['rankpos'] == "9" ||$arr['rankpos'] == "10" ||$arr['rankpos'] == "11"){ ?>
    <table align="center" width="100%" class="tbl">
    <tr><td align="center" class="hdr">.::Unlucky::.</td></tr>
    <tr><td align="left" class="tbl">
    GOO Away.<br />
    </td></tr>
    </table>
    <br />

    Whats wrong with this? Im trying to make it so that if your rankpos isnt at least 12, it says go away.

  2. #2
    Join Date
    Dec 2005
    Posts
    6,228
    Tokens
    1,145

    Latest Awards:

    Default

    Why don't you just do... :S

    Code:
    | $arr['rankpos'] >= "12" |
    i'm out of touch, i'm out of love
    i'll pick you up when you're getting down
    and out of all these things i've done
    i think i love you better now

  3. #3
    Join Date
    Nov 2008
    Posts
    217
    Tokens
    1,822
    Habbo
    eLv

    Latest Awards:

    Default

    OR

    Code:
    <?php if ($arr['rankpos'] != "12") {
    <table align="center" width="100%" class="tbl">
    <tr><td align="center" class="hdr">.::Unlucky::.</td></tr>
    <tr><td align="left" class="tbl">
    GOO Away.<br />
    </td></tr>
    </table>
    <br />
    <?php } ?>






  4. #4
    Join Date
    Nov 2006
    Location
    Narrich
    Posts
    5,687
    Tokens
    0
    Habbo
    Jamesy...

    Latest Awards:

    Default

    Quote Originally Posted by xScoldx View Post
    OR

    Code:
    <?php if ($arr['rankpos'] != "12") {
    <table align="center" width="100%" class="tbl">
    <tr><td align="center" class="hdr">.::Unlucky::.</td></tr>
    <tr><td align="left" class="tbl">
    GOO Away.<br />
    </td></tr>
    </table>
    <br />
    <?php } ?>
    That wont do what he wants if the rank is above 12 though
    Ex-janitor. Might pop in from time to time, otherwise you can grab all my information from http://jamesy.me.uk/

  5. #5
    Join Date
    Jan 2007
    Location
    Wales
    Posts
    2,432
    Tokens
    141

    Latest Awards:

    Default

    <?
    if ($arr['rankpos'] >= "12")
    echo "Go away?";
    ?>
    Free Online Games And Videos:
    http://www.vincesgames.com



  6. #6
    Join Date
    Nov 2007
    Posts
    1,253
    Tokens
    150

    Latest Awards:

    Default

    I don't quite get why people are putting integers in strings?

    PHP Code:
    <?php

    if( $arr['rankpos'] < 12 ) echo 'Go Away!';

    ?>
    Also I am pretty sure everyone has been using the equal to or more than operator, when he clearly stated he wanted it to show go away if the level wasn't at least 12.

  7. #7
    Join Date
    Dec 2006
    Location
    Swindon
    Posts
    3,299
    Tokens
    215
    Habbo
    dunko

    Latest Awards:

    Default

    Quote Originally Posted by Source View Post
    I don't quite get why people are putting integers in strings?

    PHP Code:
    <?php

    if( $arr['rankpos'] < 12 ) echo 'Go Away!';

    ?>
    Also I am pretty sure everyone has been using the equal to or more than operator, when he clearly stated he wanted it to show go away if the level wasn't at least 12.
    No need for if there, you could easily do


    PHP Code:
    <?php

    echo ( $arr['rankpos'] < 12 ) ? "Go Away""Hello";

    ?>
    Where hello is the content

  8. #8
    Join Date
    Nov 2007
    Posts
    1,253
    Tokens
    150

    Latest Awards:

    Default

    That is really extremely illogical blob, apart from the fact you may have wanted to show off you can do some extremely basic PHP work.

    Those statements ( : ? ) should only be used for setting variables in my personal opinion as what you have done would look messy and unorganised if it was a big amount of content. He wanted a simple if, else statement that would do it neatly and without the need to over complicate things.

  9. #9
    Join Date
    Dec 2006
    Location
    Swindon
    Posts
    3,299
    Tokens
    215
    Habbo
    dunko

    Latest Awards:

    Default

    Quote Originally Posted by Source View Post
    That is really extremely illogical blob, apart from the fact you may have wanted to show off you can do some extremely basic PHP work.

    Those statements ( : ? ) should only be used for setting variables in my personal opinion as what you have done would look messy and unorganised if it was a big amount of content. He wanted a simple if, else statement that would do it neatly and without the need to over complicate things.
    Not really, I was showing a different way to do things, that doesn't look messy at all...

  10. #10
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    Quote Originally Posted by Blob View Post
    Not really, I was showing a different way to do things, that doesn't look messy at all...
    If you've got a huge block of HTML in the echo then the ternary operator is not a smart choice.

Page 1 of 2 12 LastLast

Posting Permissions

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