user1785749
user1785749

Reputation: 13

Inserting current date into table

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

Answers (1)

John Conde
John Conde

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

Related Questions