Taku Posted February 14, 2013 Share Posted February 14, 2013 //+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 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 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"; 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 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 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 Link to comment https://forums.phpfreaks.com/topic/274489-helpabout-date/#findComment-1412465 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.