Mysql now() function as default value

QuestionsMysql now() function as default value
Azam asked 3 years ago

Can I set now() function as a default value for a field while adding a new entry?

2 Answers
Abu Ghufran answered 3 years ago

There are 2 solutions.
1. Use on_insert event handler and write your own insert query that have now().
2. Use current_timestamp default value: http://stackoverflow.com/a/168832/385377

Azam answered 3 years ago

Thank you! It works.

Your Answer

18 + 18 =

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

We are sorry that this post was not useful for you!

Let us improve this post!