Hey I need to insert current datatime into mysql database.. this is the format:
0000-00-00 00:00:00
Most easily done with MySQL directly using the NOW() function.
INSERT INTO tbl (datecol) VALUES (NOW());
If you need PHP to produce a value other than the exact current timestamp, use the format:
date('Y-m-d H:i:s', $some_unix_timestamp);
users table have? If it worked before adding NOW() that would imply that your users table has only 5 columns - the empty one '', $username, $email, $md5password, $active_code.As a MySQL query:
INSERT INTO table (fieldname) VALUES (NOW())
And wrapped in PHP:
$db = new PDO($dsn, $user, $password);
$db->query("INSERT INTO table (fieldname) VALUES (NOW())");
UNIX_TIMESTAMP() returns Unix time, an integer, not the correct MySQL date format