View Single Post
Old Jun 25th, 2007, 5:54 AM   #1
Satans_Banjo
Newbie
 
Join Date: Oct 2006
Posts: 15
Rep Power: 0 Satans_Banjo is on a distinguished road
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
Satans_Banjo is offline   Reply With Quote