SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot suro's Avatar
    Join Date
    Jan 2005
    Posts
    155
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Session already started - how to check?

    Hi
    Is there a way to check whether the session has already been started?
    I get the notice errors when I call the session_start() for more than one time (can't avoid this)

    Thanks.

  2. #2
    SitePoint Addict n0other's Avatar
    Join Date
    Feb 2005
    Posts
    290
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use if (!session_id()) { // There is no session } to test. Though comments at php.net says you should use if (session_id() == '') to check this, but a quick test gave the same results. (PHP5)

  3. #3
    SitePoint Zealot suro's Avatar
    Join Date
    Jan 2005
    Posts
    155
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if(!session_id()) works but if(session_id() == '') gives header errors which is obvious (in my code).
    Thanks.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •