I'm using an if statement to declare whether a user is an admin, mod or neither with this code below, but its messing up by always making $status = "admin" even if that person is neither, this has really baffled me.
if($info['rights'] == "m") {
$status = '<font color="#FFFFFF">(mod)</font>';
}elseif ($info['rights'] == "a"); {
$status = '<font color="#FFFFFF">(admin)</font>';
}
From stackoverflow
-
You seem to have accidentaly added a semicolon (;) after the elseif, so the second code block is always getting executed.
BoltBait : Yeah, get rid of the semicolon on line 3 and everything should work as planned. -
Is there supposed to be a semi-colon after "a")?
Ryan : Thanks guys it's working now, I feel stupid :Pdassouki : @Ryan : you should, i spent a month trying to figure out what i had done wrong in a code. in one file i had $bla and in the other $b1a -
Is $info declared? Where is $info defined and assigned?
-
You have a syntax error in your code.
You can try this:
if($info['rights'] == "m") { $status = '<font color="#FFFFFF">(mod)</font>'; } else if ($info['rights'] == "a") { $status = '<font color="#FFFFFF">(admin)</font>'; }recursive : protip: Spell the word "you" out using all three letters.shuxer : why i have to use 'You' if save my ms times with just 'U' ?ryeguy : Because saying u instead of you makes you sound like a 13 yr old girl chatting to her friends on AIM.
0 comments:
Post a Comment