update timestamp for last login
Posted: Mon Oct 05, 2009 11:04 am
Hi,
I cannot seem to get this update working properly. I am trying to automatically update the user's last login date when they login successfully. This code is automatically executed if the user logs in successfully, but right now it is inserting a blank date into the db (0000-00-00 00:00:00).
Any ideas on what I can do to fix this problem?
I cannot seem to get this update working properly. I am trying to automatically update the user's last login date when they login successfully. This code is automatically executed if the user logs in successfully, but right now it is inserting a blank date into the db (0000-00-00 00:00:00).
Any ideas on what I can do to fix this problem?
Code: Select all
$lastLogin = time();
mysql_select_db($database_connectionME, $connectionME);
$strQuery = "UPDATE userTable SET lastLogin='".$lastLogin."' WHERE username='".$loginUsername."'";
mysql_query($strQuery) or die(mysql_error());