$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 只是为了测试,但它不起作用。
- title, edition, author, isbn, condition, description, photo 都是 varchars
- uid 是一个整数
- 描述是文字