Log in

View Full Version : assigning a session to user



ravi951
09-22-2011, 09:36 AM
hi all,
i have written a code in php that will check whether the session exists
or not and it will generate the session id.
below is the code.....


<?php
session_start();
mysql_connect("localhost","root","") or die("mysql_error()");
mysql_select_db("shopping") or die("mysql_error()");

if(!isset($_SESSION['username']))
{
print "Your SessionID: ".time();
}
else
{
print "Session does not exist";
}
?>

now i want that session id to be assigned to each user.
tell me how to do it....