Jump to content

Help(about date)


Taku

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

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";

 

 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.