SystemOverload Posted September 10, 2009 Share Posted September 10, 2009 PHP 5.2.6 Hi.. I need to insert a time into an MySQL DB. It needs to be done by the php, as opposed to the database doing the maths... What is the best way to insert a "now + 24 hrs" etc into a db, I just need the value, not the SQL Statement.. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/173786-solved-date-time-a-few-hours/ Share on other sites More sharing options...
fenway Posted September 10, 2009 Share Posted September 10, 2009 It needs to be done by the php, as opposed to the database doing the maths... Why? It's a joke in mysql -- NOW() + INTERVAL 24 HOUR. Quote Link to comment https://forums.phpfreaks.com/topic/173786-solved-date-time-a-few-hours/#findComment-916067 Share on other sites More sharing options...
SystemOverload Posted September 10, 2009 Author Share Posted September 10, 2009 because it's not an event I can trigger, so how do i do it in PHP, ensuring it's formatted ready for mysql? Quote Link to comment https://forums.phpfreaks.com/topic/173786-solved-date-time-a-few-hours/#findComment-916069 Share on other sites More sharing options...
SystemOverload Posted September 10, 2009 Author Share Posted September 10, 2009 Ignore my previous ignorance, you were totally right I just wasn't thinking about the problem in the right way... UPDATE tbl_listings SET c_password_reset_code = 'afe915b81e02df723a1df0ee3e70a75e', c_password_reset_valid_to =NOW() + INTERVAL 24 HOUR WHERE contact_email = 'someone@live.co.uk' Thank you Quote Link to comment https://forums.phpfreaks.com/topic/173786-solved-date-time-a-few-hours/#findComment-916100 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.