Jump to content

Session problem


rward

Recommended Posts

Hi,

I am wondering if anybody can help here. basically what i want to do is at the start of my site check if the sessions are set and if not set them. My problem is that on calling the following snippet of code it processes the first time but does not actually assign the  var 'session_id' until after a refresh or hitting the home page link that first calls this function.

Which results further down the line as two entrys into my database first one blank and second one with the 'session_id' var correctly.

 

if (!isset($_SESSION['session_id'])) {

session_start();

$_SESSION['session_id'] = $PHPSESSID;

 

...save to database the variable session_id....

}

 

Regards

Rob

Link to comment
https://forums.phpfreaks.com/topic/49775-session-problem/
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.