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'"); Quote 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. Quote 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. Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/182539-datetime-will-not-update/#findComment-963457 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.