Jump to content

cant assign time to a session variable using date()??


spryce

Recommended Posts

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

Link to comment
Share on other sites

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

 

 

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.