I have this session variable which i am trying to set to an access level when the users logs in with this:
$accessquery = mysql_query("SELECT roleid FROM person WHERE email = '". $email ."'");
$access = mysql_fetch_array($accessquery);
$_SESSION['Access'] = $access;
However it says that 'Access' is undefined, what is the problem?
EDIT*
if (($_SESSION['Access']) == "2")
Error appears here
EDIT*
Session Start has been called.
Two possibilities here :
session_start();
at the begining of page.use the following code:
$accessquery = mysqli_query($conn, "SELECT roleid FROM person WHERE email = '". $email ."'", mysqli_store_result($conn));
$access = mysqli_fetch_row($accessquery);
$_SESSION['Access'] = $access[0];
To figure out what's going on, I recommend you to use
print_r($any_variable);
Did you call session_start();
?
Try to debug your code with just a fixed value: $_SESSION["Test"]="test";
and then do a var_dump($_SESSION);