php - PHP 中的 MySQL 语法错误

标签 php mysql

<分区>

$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 只是为了测试,但它不起作用。

  1. title, edition, author, isbn, condition, description, photo are all varchars
  2. uid is an int
  3. description is text

最佳答案

condition 是 mysql 中的保留字。使用`条件`

关于php - PHP 中的 MySQL 语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10083360/

相关文章:

php - 请求: minimal framework for web-apps

php - 如果电子邮件匹配,则使用 php 重定向

php - Tumblr API 从 HTML Canvas 发布照片

PHP date() 可靠性

mysql - 在 rails 中使用特定的 mysql 索引

mysql - 执行命令时遇到 fatal error

php - 在页面加载时将数据插入 mysql 数据库

mysql - 如何在不使用子查询、limit 和 top 子句的情况下在 mysql 中查找第二高的薪水

c# - SQL Linq 预留可用性

mysql - 从包含特定用户的图表中获取 chat_id