I have got a basic login script at the moment.
When the user logs in 2 variables are defined:
$_SESSION['user_id'] = $user['user_id'];
$_SESSION['username'] = $user['username'];
the index.php file has this
session_start();
if(array_key_exists('user_id', $_SESSION) && array_key_exists('username', $_SESSION)):
That is all fine, however once the session is started I would like to add more values from a database so I have this code here:
$res = mysql_query($sql);
$_SESSION = mysql_fetch_assoc($res);
When I do this it overrides the $_SESSION['user_id'] and $_SESSION['username']. I tried this:
$_SESSION .= mysql_fetch_assoc($res);
but it didn't work.
Does anyone have any ideas?
Thanks peter