I'm building registration form for my teacher's website. I have created database called "students" with various rows like "name, surname etc." Now I would like to add a column named "date_submitted" which will automatically insert current date and time to the row when data is submitted.
For example a student submits his data, the data is inserted into the table and mysql automatically fills the date and time when this insertion occured.
I tried @MLBDG answer from this question MySQL date column auto fill with current date but it doesn't work.
This is the way I do it:
Query:
ALTER TABLE `students` ADD `date_submitted` TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER ;
The error I'm receiving:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Server version: 5.5.34 - MySQL Community Server (GPL)