pneudralics Posted November 22, 2009 Share Posted November 22, 2009 lip updates, but not lastlogin. lastlogin is used to record the current datetime. Everytime I hit submit all it gives me are zeros. mysql_query ("UPDATE user SET lip = '$ip', lastlogin = 'NOW()' WHERE id = '$id'"); Link to comment https://forums.phpfreaks.com/topic/182539-datetime-will-not-update/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 22, 2009 Share Posted November 22, 2009 NOW() returns a string and there is no need to put single-quotes around it in the query. Link to comment https://forums.phpfreaks.com/topic/182539-datetime-will-not-update/#findComment-963449 Share on other sites More sharing options...
Mchl Posted November 22, 2009 Share Posted November 22, 2009 NOW() returns a string and there is no need to put single-quotes around it in the query. Actually what NOW() returns depends on context. SELECT NOW(),NOW() + 0; But 'NOW()' in quotes is just a literal string, the function is not being evaluated. Link to comment https://forums.phpfreaks.com/topic/182539-datetime-will-not-update/#findComment-963456 Share on other sites More sharing options...
pneudralics Posted November 22, 2009 Author Share Posted November 22, 2009 Thanks, just took the quotes out and it's working. Link to comment https://forums.phpfreaks.com/topic/182539-datetime-will-not-update/#findComment-963457 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.