2 sessions variables, isset checking!
I have written the following piece of code
if( (!isset($_SESSION['home'])) || (!isset($开发者_如何学Python_SESSION['away'])) )
I assume this should check if each of these variables exist. I only show whats in the if statement if either of those variables dont exist.
But for some reason it is still showing the stuff inside the braces even though the variable 100% exists.
Is the code wrong? Thanks
Then you need an 'AND' (&&) statement, not an 'OR' (||), if I understand correctly...
if( (!isset($_SESSION['home'])) && (!isset($_SESSION['away'])) )
I think what you actually meant is:
if(!((!isset($_SESSION['home'])) || (!isset($_SESSION['away'])))){
//code if at least one of those variables exists
}else {
//the other thing
}
精彩评论