| Posted by Tim Van Wassenhove on 07/06/07 11:37 
On 2006-01-17, Steve <ThisOne@Aint.Valid> wrote:> On Tue, 17 Jan 2006 00:17:03 +0000, Pedro Graca wrote:
 >
 >> camou wrote:
 >>> I get this error message: A session had already been started - ignoring
 >>> session_start().
 >>>
 >>> How can I check to see if a session was started already?
 >>
 >>
 >>     if (!session_id()) {
 >>       /* session not started */
 >>     }
 > I thought it was
 >
 > if (session_id() == "")
 > {
 >        /* session not started */
 > }
 
 There are some usercomments about that in the manual on
 http://www.php.net/session_id
 
 I prefer to do it as following:
 
 if (!isset($_SESSION)) {
 // session is not started.
 }
 
 As documented on http://www.php.net/session the global $_SESSION only becomes
 available after the use of session_start();
 
 --
 Met vriendelijke groeten,
 Tim Van Wassenhove <http://timvw.madoka.be>
 [Back to original message] |