I have a MySQL database. All the fields, I assign and I have a datestamp for my date field.
it automatically generates YYYY-MM-DD HH:MM:SS like this 2011-11-21 21:31:37
However, I would like it to do so in two diffrent columns:
A date field with YYYY-MM-DD or 2011-11-21
A time field with HH:MM:SS or 21:31:37
This is my insert php code
$sql= "INSERT INTO `db`.`table` (`id` ,`fkid` ,`paid` ,`date`)
VALUES (NULL, '$userid', '0', CURRENT_TIMESTAMP);";
I have tried CURRENT_DATESTAMP and it does not work.
The 2nd part of the question is: how to I make the table so it works with the proper code? Should the structure of the of the field be type text, or date?