它不斷收到此SQL錯誤,但我非常確定查詢中沒有錯誤。我一直盯着它太久。還有什麼可能導致這種情況?mySQL語法錯誤,但是沒有錯誤?
INSERT INTO game_data (clue, image, answer, wrong, right) VALUES ('asdf', 'asdf', 'asdf', 'assdf', 'asdf')
Invalid Query: 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 'right) VALUES ('asdf', 'asdf', 'asdf', 'assdf', 'asdf')' at line 1
我已經用這個確切的代碼運行其他查詢,只是交換了變量,它的工作原理。
和良好的措施,有可能產生這樣的PHP:
$sql = "INSERT INTO game_data (clue, image, answer, wrong, right) VALUES
('" . $clue . "', '" . $image . "', '" . $answer . "', '" . $wrong . "', '" . $right . "')";
順便說一句,「錯誤」和/或「正確」的價值是什麼?此外,所有這些「。東西都是不必要的 – Strawberry