How to put the current datetime in MySQL using PHP
How to put the current dateti开发者_如何学Pythonme in MySQL using PHP?
The result should be:
mysql_query("INSERT INTO users (r_date) VALUES ('the current datetime')");
The type of r_date
is datetime
.
If your field is a DATE or DATETIME, NOW()
will work:
INSERT INTO users (r_date) VALUES (NOW());");
Note that the now() function insert current date of MySQL server. If you need to insert server date you should use php date function
精彩评论