Where do I apply this:
TIMESTAMP columns other than the first may also be set to the current date and time. Just set the column to NULL or to NOW().
If I set the column to NULL or put NOW() in the default value then date comes up 0000-00-00 upon record insert.
If I put a hidden field and submit 0000-00-00 I get same result.
So how do I just get date once upon record creation?
Thanks
RR
How do I set MySQL column to current date on insert only?
Moderator: General Moderators
try this
I just spent a bunch of time playing with datefields and the like and the only way i could consistenly get it to work right was by doing this.
INSERT INTO someTable (name, address, date) VALUES($name, $address, date_format(NOW(), "%Y%m%d"));
this will explicitly set the NOW value that is being generated and make sure that it will be set into the db as 2003/02/06 or something like that.
phpScott
INSERT INTO someTable (name, address, date) VALUES($name, $address, date_format(NOW(), "%Y%m%d"));
this will explicitly set the NOW value that is being generated and make sure that it will be set into the db as 2003/02/06 or something like that.
phpScott