Taku Posted February 14, 2013 Share Posted February 14, 2013 (edited) //+90 days $date = date("Y-m-d",strtotime("+90 day")); $date1 = date("Y-m-d",strtotime($date)); echo $date1; if(isset($_POST['Submit'])) { if(!$date1) { } else { $query1 = "UPDATE testdate SET end = $date1 WHERE id=1"; mysql_query($query1) or die('error'.mysql_error()); } } guys help... I wanted to get the default date then add 90 days on it and then update the table with its values.. but all I get is 0000-00-00 Edited February 14, 2013 by Taku Quote Link to comment https://forums.phpfreaks.com/topic/274489-helpabout-date/ Share on other sites More sharing options...
Stooney Posted February 14, 2013 Share Posted February 14, 2013 (edited) you're second line with $date1 is what's killing it. Just do $date = date("Y-m-d", strtotime("+90 days")); Also, if it's just a simple database thing, you can do $query1 = "UPDATE testdate SET end = (now() + INTERVAL 90 DAY) WHERE id=1"; Edited February 14, 2013 by Stooney Quote Link to comment https://forums.phpfreaks.com/topic/274489-helpabout-date/#findComment-1412461 Share on other sites More sharing options...
Taku Posted February 14, 2013 Author Share Posted February 14, 2013 (edited) you're second line with $date1 is what's killing it. Just do $date = date("Y-m-d", strtotime("+90 days")); Also, if it's just a simple database thing, you can do $query1 = "UPDATE testdate SET end = (now() + INTERVAL 90 DAY) WHERE id=1"; I tried doing the 1st one it still gave me 0000-00-00 and the 2nd one work.. tnx so much guess I will use this one Edited February 14, 2013 by Taku Quote Link to comment https://forums.phpfreaks.com/topic/274489-helpabout-date/#findComment-1412464 Share on other sites More sharing options...
Stooney Posted February 14, 2013 Share Posted February 14, 2013 The second one was the more proper method anyway Quote Link to comment https://forums.phpfreaks.com/topic/274489-helpabout-date/#findComment-1412465 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.