Home > Backend Development > PHP Tutorial > 向access插入时间数据总提示异常

向access插入时间数据总提示异常

WBOY
Release: 2016-06-13 13:49:50
Original
1078 people have browsed it

向access插入时间数据总提示错误
向access插入时间数据总提示错误
代码如下:
。。。。。。略
$nowdate = date("Y-m-d H:i:s");
$query = "INSERT INTO product (filename,title,keyroot,readme,update) VALUES ('$product','$title','$keyboot','$readme','$nowdate')"; 
@$db->Execute($query) or die ($db->ErrorMsg());
前四个都是TEXT格式,最后一个是日期时间,如果把最后一个去掉就能正常插入。加上就提示“INSERT INTO 语句的语法错误。”百思不得其解,请高手指点。

------解决方案--------------------
$nowdate = date("#Y-m-d H:i:s#");

...... ,'$readme',$nowdate)";

既然是 日期时间 类型字段,插入的又是当前日期
直接写 now() 不是更好些?

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template