newbie8899 Posted December 17, 2007 Share Posted December 17, 2007 Hi, I am a newbie in PHP. I am trying to work out with PHP session id.. but there r something confuse me.. can someone explain to me please.. thanks first. as i m using this code: session_start(); if(isset($_SESSION['views'])) $_SESSION['views'] = $_SESSION['views']+ 1; else $_SESSION['views'] = 1; echo "views = ". $_SESSION['views']; As what i see here, once i refresh the browser, the session id will increase 1. the problem is, if i 1 to pass the session id from the first page till the last page, but half way the user refresh the browser, then the session id will keep on changing.. so how? besides, when i open 2 different browsers from different pc, the session id for both pc will all showing 1. If in this case, lets say i would like to save the session id into the db, then it will become 2 same session id in the table? i thought the session id will be unique? i really confuse with this session id stuff. can anyone help to explain how exactly the session id run and what is the actual purpose for this.. thanks a lot. Quote Link to comment https://forums.phpfreaks.com/topic/81996-solved-about-php-session-id/ Share on other sites More sharing options...
~n[EO]n~ Posted December 17, 2007 Share Posted December 17, 2007 session id session id will be unique, try this in different browser <?php session_start(); $SID = session_id(); echo $SID; ?> btw, what are you trying to do Quote Link to comment https://forums.phpfreaks.com/topic/81996-solved-about-php-session-id/#findComment-416637 Share on other sites More sharing options...
holiks Posted December 17, 2007 Share Posted December 17, 2007 As what i see here, once i refresh the browser, the session id will increase 1. do you really mean session id here or your "session views"? I would take neon's advice and look it up dear Quote Link to comment https://forums.phpfreaks.com/topic/81996-solved-about-php-session-id/#findComment-416748 Share on other sites More sharing options...
newbie8899 Posted December 18, 2007 Author Share Posted December 18, 2007 yaya.. i really make a big mistake. shud use session_id(). thanks a lot guys.. u guys really help me a lot. Quote Link to comment https://forums.phpfreaks.com/topic/81996-solved-about-php-session-id/#findComment-417274 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.