开发者

How to put the current datetime in MySQL using PHP

开发者 https://www.devze.com 2023-01-23 11:52 出处:网络
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\')\");

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

0

精彩评论

暂无评论...
验证码 换一张
取 消