|
Entering DATETIME values with PHP
Hi
I'm pretty new to PHP/MySQL and I am having trouble entering dates into a database. I've got the database set up and one of the fields is a DATETIME field. What I want to do is put the time that the record was entered into that file. This is what I'm currently doing, but it leaves the date as the default value in the database (0000-00-00 00:00:00):
[PHP]$phpTime = time();
$mySqlTime = gmdate("YYYY-mm-dd H:m:s", $phpTime);
$dateAdded = strtotime($mySqlTime . " GMT");[/PHP]
Is that completely wrong or am I just missing something trivial and/or blindingly obvious?
Thanks,
Banjo
|