Jump to content

[SOLVED] Does session_start have to be called inside a function?


therealwesfoster

Recommended Posts

session_start() needs to be called before you use a session variable.  Doesn't matter if it's inside or outside of a function.  session variables are already global.  If you assign something to a session variable without (or before) calling session_start(), it will act like a normal global variable for that page, but will not persist to other pages.

Link to comment
Share on other sites

hmm I coulda swore I saw a question mark in there, hence the statement. My bad.  But for argument sake, for #1, I meant it in a more generic sense.  As in, if you're going to take the time to put it in one place, why not just put it in another place, click the proverbial run button and see what happens?

Link to comment
Share on other sites

hmm I coulda swore I saw a question mark in there, hence the statement. My bad.  But for argument sake, for #1, I meant it in a more generic sense.  As in, if you're going to take the time to put it in one place, why not just put it in another place, click the proverbial run button and see what happens?

 

10-4. I wasn't offended ;)

 

Wes

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.