To create a datetime field in mysql database, create a DATETIME fieldtype, e.g.
the sql "CREATE TABLE [tablename] id INT NOT NULL AUTO_INCREMENT PRIMARY KEY , last_updated DATETIME NOT NULL" will create a autoincrement primary key "id" and a DATETIME field "last_updated"
To insert a datetime into the above table from php, the php code looks like:
"INSERT INTO [tablename] (last_updated) value (\"".date("Y-m-d H:i:s")."\");" where date("Y-m-d H:i:s") is the php statement that gets the current date format.
This comment has been removed by the author.
ReplyDelete