Jump to content

Comparison issues. (IF Statement)


ChrisMartino

Recommended Posts

Hey there,

 

Now usually after a while I can always solve bugs with my code but this one really has me at a halt here.

 

So basically I have a function that returns true if the accounts username = demo and false if it doesn't but the following if statement returns true and executes the code every time regardless of the returned value of the function like so:

 

if(isset($_POST['server_start']) or isset($_POST['server_stop']) or isset($_POST['server_restart']) && $Class['Account']->is_demo_account($_SESSION['account_id']) == false)

 

 

Now if I run the following code right above that:

 

if($Class['Account']->is_demo_account($_SESSION['account_id']) == false) echo "it isn't a demo account.";
else echo "it is a demo account.";

 

It will echo "it is a demo account" correctly. Now can somebody please tell me why the if statement with the post values in always return true.

 

Thanks for your time!

Link to comment
https://forums.phpfreaks.com/topic/224888-comparison-issues-if-statement/
Share on other sites

Are you trying to get a TRUE evaluation: if (any one or more of the first 3 conditions) AND (last condition) ?

 

Yea I'm trying so if any of the first 3 conditions are set and the last condition is false. So E.G if it isn't the demo account.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.