I have a form where users enter details on themselves (including email). The data is stored and then an AUTO_INCREMENT column assigns a unique ID for the user.
I want to use this unique ID as a session variable so that I can track the users progress on the site.
This is what I have at the moment and its not working:
$qry = "SELECT * FROM user_responses WHERE email='$email'";
$result = mysqli_query($qry);
$member = mysqli_fetch_assoc($result);
$_SESSION['SESS_USERID'] = $member['userid'];
echo $_SESSION['SESS_USERID'];
session_write_close();
I think that I've selected a row in the tbl where the email address is the same as what has just been processed $email is the sanitised id for the email text input. The I've run it to store it into $result. I fetch the array for it and then assign the userid.
Its not working because I get this error:
( ! ) Notice: Undefined variable: _SESSION in C:\wamp\www\bootstrap\instructions.php on line 36