Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I do and OR ***Please Help*** 2

Status
Not open for further replies.

chuckbridges

Programmer
Apr 15, 2005
19
US
If I have a statement like

if (!$result1){
$logonsuccess = 0;



How would I include a $result2 check so that if either
result tested ok the if statement would work?

Thanks
Chuck
 
Code:
if (!$result1 && !$result2) 
{
  $logonsuccess = 0;  
}
[code]
Just bind them with && for AND or || for or.
 
This may not help but just FYI there's also XOR:

Code:
// If !$result1 is true and !$result2 is false, then it will pass.
// If !$result1 is false and !$result2 is true, then it will pass.
// If !$result1 is true and !$result2 is true, it will fail.
// If !$result1 is false and !$result2 is false, it will fail.

if ( !$result1 xor !$result2 )
{
  $logonsuccess = 0;
}

---------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top