I have an unexpected ; error on this line:
$action = ($sessionMinus == $_SESSION[‘initial_count’]) ? ‘create_session2.php’;
But if I remove the ; then it states unexpected { in the line below, how can this be sorted out?
below full code:
if ($sessionMinus == $_SESSION['initial_count']){
$action = ($sessionMinus == $_SESSION['initial_count']) ? 'create_session2.php';
}else if($sessionMinus != $_SESSION['initial_count']){
$action = ($sessionMinus != $_SESSION['initial_count']) ? $_SERVER['PHP_SELF'];
}
To use the ternary operator, you need to have values for when the condition is both TRUE and FALSE:
I am not sure why you are doing the checks twice, the following should suffice: