Skip to main content
Inspiring
May 25, 2010
Question

unique session reference ?

  • May 25, 2010
  • 1 reply
  • 532 views

So I'm using session management and I need a unique session identifier to use as a key field in a table

Is session.sessionID ok for this ?

table 'webCart'

sessionID, itemID, qty

I'm happy once the session times out, the cart row(s) won't be available

This topic has been closed for replies.

1 reply

Inspiring
May 25, 2010

I think you'd be safer with a uuid.  Another way to ensure a unique value would be to concatonate a timestamp to the end of the session id.

Inspiring
May 25, 2010

Thanks Dan

So the session ID isn't truly unique ?

I'll use the UUID function then

I'll save the UUID as a session variable

I'll use the variable as my unique key in the webCart table, so I can insert / retrieve rows for that particular session

Inspiring
May 25, 2010

To see if a session id is unique, go to a page where you can get one.  Record the value.  Re-boot your browser and go back to the same page.  Are the values the same or different?