$query = "INSERT INTO textbooks (uid, title, edition, author, isbn, condition, description, photo) VALUES (9, 'q', 'a', 'b', 'c', 'd', 'e', '$extension')";
$result = mysql_query($query) or die('Could not connect: ' . mysql_error());
Could not connect: 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 'condition, description, photo) VALUES (9, 'q', 'a', 'b', 'c', 'd', 'e', '.jpg')' at line 1
我一直在收到一個MySQL語法錯誤,但我不能爲我的生活弄清楚什麼是錯的。我放置了隨機變量,字符串和int只是爲了測試,但它不工作。PHP中的MySQL語法錯誤
- 標題,版本,作者,ISBN條件,描述,照片都是VARCHAR處理
- UID是一個int
- 介紹文字
你試過用'而不是單引號? – mc10 2012-04-10 05:10:09
'CONDITION'是[保留關鍵字](http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html)。 – Wiseguy 2012-04-10 05:11:10