de_oracle Posted March 14, 2007 Share Posted March 14, 2007 Im a new programmer for php. when I programming with session I got errors. Here the question. I make small code to gte seeeion id. but when I reload the page it appear different id at diffrerent times. This is my code <?php session_start(); echo "<p>Your session ID is ".session_id().".</p>"; ?> But I have heard about that session id cannot change when reload the page. How can I solve this. Thanks de_oracle Link to comment https://forums.phpfreaks.com/topic/42606-session-error/ Share on other sites More sharing options...
per1os Posted March 14, 2007 Share Posted March 14, 2007 Make sure cookies are enabled. Also you can pass the session ID through the URL and start the session using that. I think the variable is $_SERVER['PHP_SESSID'] or something similar. However for SEO purposes the cookie way is much better --FrosT Link to comment https://forums.phpfreaks.com/topic/42606-session-error/#findComment-206758 Share on other sites More sharing options...
de_oracle Posted March 14, 2007 Author Share Posted March 14, 2007 Thanks. But I didnt get it. suppose that when I run the page first time session id is d33ea4152eda39aba6c0cf41bb4e67b2. But when the page reload it gets different id. So I cannot use user tracking things in my code.In browser I have enable cookies. Link to comment https://forums.phpfreaks.com/topic/42606-session-error/#findComment-207307 Share on other sites More sharing options...
per1os Posted March 14, 2007 Share Posted March 14, 2007 http://us2.php.net/manual/en/function.session-id.php Use the session_id($SID) to set the session Other than that I am not sure, I never came across that problem. But I also have my php configured not to append the session id onto urls, maybe that has something to do with it. --FrosT Link to comment https://forums.phpfreaks.com/topic/42606-session-error/#findComment-207312 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.