尝试做一个简单的插入,这一行给我带来了问题。我这辈子都看不出它有什么问题。所以它必须非常简单,显然我需要另一双眼睛才能注意到。
mysql_query("INSERT INTO ".MLIST."(email, when) VALUES('".mysql_real_escape_string($_POST['email'])."', '".$timeNow."')") 或死亡(mysql_error());
错误是
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 ''email', 'when') VALUES('me@domain.com', '2012-06-11 03:58:55')' at line 1
最佳答案
WHEN
是关键字 - 将其放在反引号内:
INSERT INTO ... (`email`, `when`) ...
关于PHP mySQL完整性检查,查询错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10976364/