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

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

 

 

 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.