How to insert the current time field to the mysql database
Source: Internet
Author: User
How to insert the current time field to the mysql database? $ Conn-& gt; prepare (& quot; INSERTINTOaaa (name, mydate) VALUES (trim (: name), now () & quot;); this cannot be executed, how should I change it ?, No. how do I insert the current time field to the mysql database?
$ Conn-> prepare ("insert into aaa (name, mydate) VALUES (trim (: name), now ())");
This cannot be executed. how can I change it?
------ Solution --------------------
Error reported during failed execution
What type is mydate? change it to DATETIME.
------ Solution --------------------
$ Conn-> prepare ("insert into aaa (name, mydate) VALUES (trim ('name'), now ())");
In addition, if you do not know how to debug the program, you can run the SQL statement in the mysql management tool. if the SQL statement is incorrect, the system prompts you why it is incorrect, you can debug and modify it.
------ Solution --------------------
Insert into 'AAA' Set name = 'abc', mydate = '". time ()."'
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service