Reputation: 13
I want to insert the current date into the table from my php page but i don't know how to do so. I would also like to know if i am constructing the table right wrt the data type being used. Its a normal "date" data type. Thank you!!
Upvotes: 0
Views: 457
Reputation: 219814
You can do this a variety of ways like:
INSERT INTO tablename (datecolname) VALUES (CURRENT_DATE)
INSERT INTO tablename (datecolname) VALUES (CURRENT_DATE())
INSERT INTO tablename (datecolname) VALUES (NOW())
INSERT INTO tablename (datecolname) VALUES (CUR_DATE())
INSERT INTO tablename (datecolname) VALUES (CURRENT_TIMESTAMP())
INSERT INTO tablename (datecolname) VALUES (CURRENT_TIMESTAMP)
See Mysql's Date and Time functions for more
Upvotes: 1