Page 1 of 1

Unique Session

Posted: Fri Nov 02, 2007 4:07 am
by phpcoder
Hi,
What is the best way of creating a unique session Id. I am creating a shopping cart but on that shopping cart user dont have to get register to buy anything so ther is no user name.

Thanks

Posted: Fri Nov 02, 2007 4:17 am
by Christopher
You could just use the PHP session id itself.

Posted: Fri Nov 02, 2007 10:45 am
by louie35
if you are going to use session just make sure the user accepts them first then do the cart thing.

set a session, then try to read it back.

Posted: Fri Nov 02, 2007 11:46 am
by patrikG
louie35 wrote:if you are going to use session just make sure the user accepts them first then do the cart thing.

set a session, then try to read it back.
Sorry, I can't quite follow your logic. When PHP starts a session, as aborint mentions, it automatically creates a unique session ID. See http://www.php.net/session and session_start()