Page 1 of 1

insert into the database date and the time

Posted: Sun Feb 09, 2003 4:45 pm
by mingo
I am using an HTML form to insert information into a database using PHP and mySQL. (information such as surname, name, email,...)

Does anyone know how to insert into the database the date and the time when the user inputs this information without creating a field in the HTML form?

Thank you very much. :?:

Posted: Mon Feb 10, 2003 2:58 am
by twigletmac
If you create a DATETIME field in your database table then you can just set that to NOW() in your INSERT statement, eg.:

Code: Select all

INSERT INTO table (field1, field2, field3, datetimefield) VALUES(formdata1, formdata2, formdata3, NOW())
Mac