[Solved] If/Else return TRUE when not true in PHP [duplicate]


Your logic is incorrect. I will try in english to say what your if statement does:

If $userrow['name'] equals the value held in the variable $user1, or if the value held in the variable $user2 is not falsey

In $user2 you have the value “Gil”. Since “Gil” is not falsey (in other words, it is not false or null or zero), then it is considered to be true when evaluated within the context of an if statement. I think this is what you want to say instead:

if ($userrow['name'] == $user1 || $userrow['name'] == $user2 ) {

solved If/Else return TRUE when not true in PHP [duplicate]