Jump to content

[SOLVED] About PHP session id


newbie8899

Recommended Posts

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.

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.