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
https://forums.phpfreaks.com/topic/81996-solved-about-php-session-id/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.