php - 尝试清除我的数据库时出现语法错误

标签 php mysql symfony doctrine-orm doctrine

每当我尝试加载我的数据夹具时,我都会收到此错误:

[Doctrine\DBAL\Exception\SyntaxErrorException]
An exception occurred while executing 'DELETE FROM order':

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error i n your SQL syntax; check the manual that corresponds to your MySQL server v ersion for the right syntax to use near 'order' at line 1

最佳答案

因为 order 是 mysql 中的保留关键字,所以尝试如下:-

DELETE FROM `order`

表示在表名周围使用反引号

引用:- MYSQL Reserve Words & Keywords

关于php - 尝试清除我的数据库时出现语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35346917/

相关文章:

doctrine-orm - 带有附加参数的多对多

php - Symfony 中的翻译文件不存在

php - Symfony 查找器 : Finding all directories except ones that start with an underscore

php - 在 PHP 中检测表单上的俄语字符

php - Symfony 表单错误 - 名称为空的表单不能有父表单

mysql - 使用 SELECT 查询更新数据(有两个相关表)

MYSQL 删除和回滚

php - 带有多维数组的 Wordpress PHP MySQL 查询

javascript - 使用 bootstrapvalidator 发送成功验证后的发布请求

mysql - 如何在 MySQL 中设置正确的索引或编写正确的查询?