I have a PHP form which allows a job candidate to fill in information and upload a resume. The submission date is a field in the database which is supposed to automatically log the date of submission when the info is added. As such, there is no DATE field to fill in on the form. However, when the data is inserted, everything is entered...except for the DATE. It reads 0000-00-00 instead of the appropriate date.
Is there some extra setting needed on the DATE field in the database to make it work? Or am I supposed to put some kind of HIDDEN INPUT code for the submitDate field in the form itself?
[SOLVED] auto date won't show up in database
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
If you want the current date to be updated without intervention from yourself, use a TIMESTAMP field, this will change every time the data is added or updated.
However, if this is simply a date added field, then you should use MySQL's NOW() function when doing your insert, e.g.
Mac
However, if this is simply a date added field, then you should use MySQL's NOW() function when doing your insert, e.g.
Code: Select all
INSERT INTO your_table (column1, column2, date_added) VALUES('value1', 'value2', NOW())