Jump to content

session_start()


jeeva

Recommended Posts

session_start(); declares that you are starting a session. If you try to use session variables without starting a session it will most likely turn out that your variables will not be available to you because a session has not been registered. (Unless, session.auto_start is set to 1 in php.ini)

[quote author=jeeva link=topic=124499.msg515907#msg515907 date=1170051171]
wt will happen when i start the session?
[/quote]

Is what happens when you start a session, is that it looks for an active session for this particular user and if no session is active, then it starts a new one. You can call session_start() on all your pages and never use a session var and no harm will be done.
Link to comment
Share on other sites

[quote author=pikemsu28 link=topic=124499.msg515929#msg515929 date=1170055435]
the session_start() is required before any html and allows the script to store variables
[/quote]

This is really important. If you don't place the session_start() at the very beginning of a file, before the <html> tag, you are probably going to get header errors.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.