php - Can't insert datetime to MySql -
This is strange when I get a date time: $ date = date ("Ymd H: i : S ");
and try putting it into the database, it will insert null
. The column I inserted is a datetime. It does not matter which column I change the data, it will still include zero.
I hope someone can help me!
Because column
in your query instead of a routine
$ sql = "... datefield = '$ date' ....";
do
$ sql = "... datefield = TIMESTAMP ('$ date') ....";
Obviously .... represents your SQL at that point.
Comments
Post a Comment