我可以从xml读到一个时间:1235716200000
似乎用的date的时候需要除1000
所以我用$start_time = $post->getElementsByTagName("StartTime")->item(0)->nodeValue/1000;然后$query="INSERT INTO `test` (`start_time`) VALUES (".$start_time.")";
结果报错You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '06:30:00)' at line 1加两个引号$query="INSERT INTO `test`(`start_time`) VALUES ('".$start_time."')";
也报错Incorrect datetime value: '1970-01-01 00:00:00' for column 'start_time' at row 1求教达人,这是什么问题?原因是什么,应该怎么正确插入
似乎用的date的时候需要除1000
所以我用$start_time = $post->getElementsByTagName("StartTime")->item(0)->nodeValue/1000;然后$query="INSERT INTO `test` (`start_time`) VALUES (".$start_time.")";
结果报错You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '06:30:00)' at line 1加两个引号$query="INSERT INTO `test`(`start_time`) VALUES ('".$start_time."')";
也报错Incorrect datetime value: '1970-01-01 00:00:00' for column 'start_time' at row 1求教达人,这是什么问题?原因是什么,应该怎么正确插入
解决方案 »
- ANSI转utf-8
- 用PHP在数据库怎么实现这样的Json
- 在空间服务商那买了个mysql的空间,怎么把本地的表放上去?
- 呵呵,我是搞Java的,第一天尝试php,提个小问题:php有没有类似jsp那样的ide开发环境呢(Eclipse、Jbuilder)?
- 字符串比较函数调用出错,补救!
- 有没有WEB邮件系统的PHP源代码
- 请问产生一个随机数。请问用php代码如何实现。我在线等待。
- 为什么没法访问?请看
- 请教各位!哪里有完整的WIN98+PHP+APACHE+MYSQL的设置方法?
- 麻烦大神帮忙解决"未交房租统计的问题", 不胜感激~~
- 谁整过uchome二次开发
- mysql 怎么样实现语句流程控制的?
if (!$result){
echo $query."\n";
echo $db->error.$discover.'<br />';
}else{
//echo $Title."added.<br />";
}
$query="INSERT INTO `test` (start_time) VALUES ($start_time)";
这样子应该可以吧