spryce Posted June 3, 2011 Share Posted June 3, 2011 i cant figure out why this doesnt work. I just want to store the time that the user logged in. The other data is pulled from the db. $found_user = mysql_fetch_array($result); $_SESSION['id'] = $found_user['id']; $_SESSION['username'] = $found_user['username']; $_SESSION['user_f_name'] = $found_user['user_f_name']; $_SESSION['access_level'] = $found_user['access_level']; $_SESSION['time'] = date('h:i:a'); // Whats wrong with this ?? Cheers Quote Link to comment https://forums.phpfreaks.com/topic/238272-cant-assign-time-to-a-session-variable-using-date/ Share on other sites More sharing options...
kenrbnsn Posted June 3, 2011 Share Posted June 3, 2011 Nothing is wrong with those statements as they stand. Why do you think there is a problem? Ken Quote Link to comment https://forums.phpfreaks.com/topic/238272-cant-assign-time-to-a-session-variable-using-date/#findComment-1224456 Share on other sites More sharing options...
WebStyles Posted June 3, 2011 Share Posted June 3, 2011 have you echoed $_SESSION['time'] to see what's being assigned to it? try: $_SESSION['time'] = date("h:i a"); // difference are the double quotes and removed the : that seperated am/pm from the time, just 'cause it seemed weird. hope this helps Quote Link to comment https://forums.phpfreaks.com/topic/238272-cant-assign-time-to-a-session-variable-using-date/#findComment-1224599 Share on other sites More sharing options...
kenrbnsn Posted June 3, 2011 Share Posted June 3, 2011 Double quotes vs single quotes aren't important here and the ":" is just a noise character to the date() function and will be put into the final string unchanged. If the OP wants a colon between the time and the am/pm designation, that's the OP's prerogative. Ken Quote Link to comment https://forums.phpfreaks.com/topic/238272-cant-assign-time-to-a-session-variable-using-date/#findComment-1224609 Share on other sites More sharing options...
jcbones Posted June 3, 2011 Share Posted June 3, 2011 have you dumped the $_SESSION array? echo '<pre>'; print_r($_SESSION); echo '</pre>'; Quote Link to comment https://forums.phpfreaks.com/topic/238272-cant-assign-time-to-a-session-variable-using-date/#findComment-1224662 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.