shreyaskudav Posted May 16, 2014 Share Posted May 16, 2014 (edited) <?phpsession_start();include 'details.php';$lastvisited = date("Y-m-d");$sql = "UPDATE users SET lastvisited = $lastvisited WHERE id = '.$id.' ";mysql_query($sql);session_destroy();?> The above code is of logout.php! When user logs out.. an entry is made of the time to the database. Datatype of the column is date. But its not working?? Its stored this value in the database: 0000-00-00 What should I do? Edited May 16, 2014 by shreyaskudav Link to comment Share on other sites More sharing options...
davej Posted May 16, 2014 Share Posted May 16, 2014 Where is your database connect? Link to comment Share on other sites More sharing options...
justsomeguy Posted May 16, 2014 Share Posted May 16, 2014 Unless lastvisited is a numeric column you need to quote that value. Link to comment Share on other sites More sharing options...
shreyaskudav Posted May 17, 2014 Author Share Posted May 17, 2014 Well its working now! Just changed the datatype from datetime to timestamp! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now