Jump to content

Updating a TIMEDATE feild using SQL alongside PHP


ATM
 Share

Recommended Posts

Hello,I know this is an easy question, but I'm not currently very good at SQL and would like to know how to update a TIMEDATE field.Currently I'm trying to use

$current_timestamp=mysql_query("SELECT CURRENT_TIMESTAMP");$mysql_update_last_login=mysql_query("UPDATE account SET last_login='" . $current_timestamp . "' WHERE user_id='1');

Link to comment
Share on other sites

  • 2 weeks later...
Hello,I know this is an easy question, but I'm not currently very good at SQL and would like to know how to update a TIMEDATE field.Currently I'm trying to use
$current_timestamp=mysql_query("SELECT CURRENT_TIMESTAMP");$mysql_update_last_login=mysql_query("UPDATE account SET last_login='" . $current_timestamp . "' WHERE user_id='1');

I dont know much about timestamp but i really think it is easyer to add it as DATETIME insted of timestamp if you just want to update the date when a user logs in.etc :$logintime = gmdate('Y-m-d h:i:s');mysql_query("UPDATE account SET last_login='$logintime' WHERE user_id='1'");->Kristian_C
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...