繁体   English   中英

将数据插入mysql数据库表中的问题:显示数据库错误

[英]issue in inserting data into mysql database table : showing DB error

我有一个称为history的数据库表,具有以下架构:

CREATE TABLE IF NOT EXISTS `history` (
  `id` int(11) NOT NULL,
  `history_date` datetime DEFAULT NULL,
  `sql_query` text,
  `authuser` varchar(200) DEFAULT NULL,
  `ip` varchar(100) DEFAULT NULL,
  `authId` int(11) NOT NULL
) ENGINE=MyISAM AUTO_INCREMENT=618 DEFAULT CHARSET=latin1;

我正在尝试在php中运行脚本,该脚本返回以下错误:

HIST DB Error :(INSERT into history(history_date,sql_query,ip,authuser,authId) VALUES(1441378485,'UPDATE itemstypes SET typedesc="Keyboard",hassoftware=0 WHERE id="10"','10.16.7.44','superadmin','6')):Incorrect datetime value:1441378485 for column 'history_date' at row 1

如果我将查询INSERT into history(history_date,sql_query,ip,authuser,authId) VALUES(1441378485,'UPDATE itemstypes SET typedesc="Keyboard",hassoftware=0 WHERE id="10"','10.16.7.44','superadmin','6')运行INSERT into history(history_date,sql_query,ip,authuser,authId) VALUES(1441378485,'UPDATE itemstypes SET typedesc="Keyboard",hassoftware=0 WHERE id="10"','10.16.7.44','superadmin','6')通过我的本地主机的phpmyadmin插入,但由于数据类型不匹配,因此在history_date列中存储了0000-00-00 00:00:00 现在,当我在实时服务器上运行该命令时,出现上述错误。 可能是什么问题? 请告诉我。 服务器中是否存在任何配置问题? 请帮我。

提前致谢。

更改日期格式,例如

INSERT into history(history_date,sql_query,ip,authuser,authId)
VALUES(2015-09-16 00:00:00,'UPDATE itemstypes
SET typedesc="Keyboard",hassoftware=0 WHERE id="10"','10.16.7.44','superadmin','6')

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM