[Solved] Inserting date()->format(Y-m-d): “Call to a member function modify() on a non-object.” [closed]


You have a typo in your code. $datetime_beginning vs $datetime_bigining

Try this:

$datetime_beginning = new DateTime('60 days ago');

do {
 $insert_days= mysql_query("INSERT INTO $tocreate (date_full) VALUES ('".$datetime_beginning->format('Y-m-d')."');") or die(mysql_error());

 $datetime_beginning->modify('+1 day');

}while($datetime_beginning!=$final_time);

4

solved Inserting date()->format(Y-m-d): “Call to a member function modify() on a non-object.” [closed]