我可以从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求教达人,这是什么问题?原因是什么,应该怎么正确插入
if (!$result){
echo $query."\n";
echo $db->error.$discover.'<br />';
}else{
//echo $Title."added.<br />";
}
$query="INSERT INTO `test` (start_time) VALUES ($start_time)";
这样子应该可以吧