1
我從MySQL收到此錯誤信息:MySQL錯誤:您在您的SQL語法錯誤
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 'key,time)
VALUES ('FreeTest','86400')' at line 2
下面是代碼:
if ((isset($_POST['key'])) && (isset($_POST['days']))) {
$key = mysql_escape_string($_POST['key']);
$days = mysql_escape_string($_POST['days'] * 86400);
$add = "INSERT INTO licence
(key,time)
VALUES
('$key','$days')";
$addkey = mysql_query($add);
}
不能使用MySQL的關鍵字'key'作爲一個MySQL表裸列名。你可以用背部抽搐(又名Grave口音)逃脫它們,但這非常俗氣。請不要使用這些字詞:https://dev.mysql.com/doc/refman/4.1/en/reserved-words.html –