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
https://forums.phpfreaks.com/topic/36145-session_start/#findComment-171651
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
https://forums.phpfreaks.com/topic/36145-session_start/#findComment-171671
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.