What do i do here?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
SirChick
Forum Contributor
Posts: 125
Joined: Tue Jul 31, 2007 11:55 am

What do i do here?

Post by SirChick »

I have a global include with session_start();
which is on every page.

Now say i have a page putting variables into a session i have to put session_start() on top of that page too but then i get the error along the lines of :

Session already started, ignoring session in (the global include)...on line 2.


I cannot remove the session from include how ever as that is what keeps the UserID in the session to be used when needs be through out the site... ?

What should i do? Have any of you had this similiar issue?
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

session_start() isn't file-specific. It can be used once per page request.
SirChick
Forum Contributor
Posts: 125
Joined: Tue Jul 31, 2007 11:55 am

Post by SirChick »

so if i only have session_start() in the include providing it is infact included then the session will work ?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

yes, after that session_start() is executed.
Post Reply