I used the following code to insert yesterday's date into my_table of a MySQL database. He worked great at WAMP and MAMP. But this does not work on my host. What reason Please help ...
$dt = new DateTime();
$d = date_add($dt,date_interval_create_from_date_string("-1 days"));
$date = $d->format('Y-m-d');
$import="INSERT into my_table (date) Values('$date')";
mysql_query($import) or die(mysql_error());
source
share