Mysql table has a column DatePosted with the Datatype as TIMESTAMP.
I am trying to insert the current TIMESTAMP into the table using PHP. However the below code does not seem to work i get 0000-00-00 00:00:00. Is the format wrong how do i get the current timestamp to be inserted in mysql
TIMESTAMP.php file
date_default_timezone_set('America/Los_Angeles');
echo date("j of F Y, \a\\t g.i a", time());
mysqli_query($con,"INSERT INTO cfv_timestamp (DatePosted) VALUES ('".date("j F Y, \a\\t g.i a", time())."' )");
.
CREATE TABLE `cfv_timestamp (
`DatePosted` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
NOW()? ...mysqli_query($con,"INSERT INTO cfv_timestamp (DatePosted) VALUES (NOW())");INSERT INTO cfv_timestamp (DatePosted) VALUES (DEFAULT)or evenINSERT INTO cfv_timestamp () VALUES ()since DatePosted has a default of CURRENT_TIMESTAMP.