Jump to content

Recommended Posts

//+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 by Taku
Link to comment
https://forums.phpfreaks.com/topic/274489-helpabout-date/
Share on other sites

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 by Stooney
Link to comment
https://forums.phpfreaks.com/topic/274489-helpabout-date/#findComment-1412461
Share on other sites

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 by Taku
Link to comment
https://forums.phpfreaks.com/topic/274489-helpabout-date/#findComment-1412464
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.