ngreenwood6 Posted November 18, 2009 Share Posted November 18, 2009 Ok so my main page has a session. I am using the session id to query the database. Now when I post to a page I have start_session() at the top but when I echo the session_id() on the main page and on the page that was posted to they are 2 different values. Why is it changing the session_id()? Is there a way to make it keep the original value? Quote Link to comment https://forums.phpfreaks.com/topic/181967-solved-session-help/ Share on other sites More sharing options...
ngreenwood6 Posted November 18, 2009 Author Share Posted November 18, 2009 anyone? Quote Link to comment https://forums.phpfreaks.com/topic/181967-solved-session-help/#findComment-959825 Share on other sites More sharing options...
JonnoTheDev Posted November 18, 2009 Share Posted November 18, 2009 The correct function is session_start() not start_session()! The session will be maintained throughout the application and should not change its id unless it is destroyed or you are failing to restore it using the session_start() function. You should place this function in an include common to all files so you do not have to add the function to all scripts, just make sure the file is included i.e include('config.inc.php'); If you are using the session id to querythe db, are you implying that you have a custom session handler using database storage? If so, maybe your problem lies there. Quote Link to comment https://forums.phpfreaks.com/topic/181967-solved-session-help/#findComment-959881 Share on other sites More sharing options...
ngreenwood6 Posted November 19, 2009 Author Share Posted November 19, 2009 yeah I am using session_start(); sorry it was a long day and I was a having some typing issues. I actually figured out the issue. A different place in code there was a session_name(); defined other than the original. So when I called session_start(); on a separate page it wasnt getting that session_name() and therefore getting a new id. Quote Link to comment https://forums.phpfreaks.com/topic/181967-solved-session-help/#findComment-960566 Share on other sites More sharing options...
MadTechie Posted November 19, 2009 Share Posted November 19, 2009 Solved? if so please click topic solved ps that wouldn't give you a new id! Quote Link to comment https://forums.phpfreaks.com/topic/181967-solved-session-help/#findComment-960576 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.