PHP Sessions - why do I get a warning notice
Hello there,
I am hoping someone can clear something up about PHP Sessions.
If I want to grab the value of something that is already stored in a session and assign it to a variable as follows.
$user_id=$_SESSION['user_id'];
This only seems to work if a session_start(); statement is called in advance.
session_start();
$user_id=$_SESSION['user_id'];
//user_id will be assigned the value that is stored in the session
The major use of sessions within the application is to maintain the logged in status.
When I call session_start() I get an warning/notice to say that the session has aready been started and as a result the call to session_start(); has been ignored.
If I remove the line however I cannot get anything out of my session.
Does anyone have any ideas?
Regards,
Claire
|