Generate and insert date into MySQL database using php -
I used the following code to insert the date my_table in my_table of MySQL database. It worked fine in WAMP and MAMP. But it does not work in my host. What will be the reason please help ... < Div class = "post-text" itemprop = "text"> Your host may not support the date time () function ... Try date () and Stratom () functions: $ dt = new date time (); $ D = date_add ($ dt, date_interval_create_from_date_string ("- 1 day")); $ Date = $ d-> Format ('Y-M-D'); $ Import = "my_table (date) values ('$ date') ''; mysql_query ($ import) or INSERT (mysql_error ()) to die;
$ today = time (); $ yesterday = date () 'YMDHH: i: S', stratetime ('- 1 day', today $));
Comments
Post a Comment