1

查询(如回显)

DELETE * FROM BlogPosts WHERE Id=?

错误

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 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 '* FROM BlogPosts WHERE Id='6'' at line 1' in /usr/www/maxtingle/Blog/System/Core/Functions.php:177 Stack trace: #0 /usr/www/maxtingle/Blog/System/Core/Functions.php(177): PDOStatement->execute(Array) #1 /usr/www/maxtingle/Blog/System/Core/BlogPost.php(201): Functions\Database->Delete('*', 'Id=?', Array) #2 /usr/www/maxtingle/Blog/System/Blog.php(102): BlogPost->Delete() #3 [internal function]: Blog::DeletePost('6') #4 /usr/www/maxtingle/Blog/index.php(52): call_user_func_array(Array, Array) #5 {main} thrown in /usr/www/maxtingle/Blog/System/Core/Functions.php on line 177
4

2 回答 2

2

ADELETE总是删除整行,因此指定要删除的字段没有意义。

你要:

DELETE FROM BlogPosts WHERE Id=?
于 2013-07-06T03:15:38.410 回答
2

您不需要*,删除整行:

DELETE FROM BlogPosts WHERE Id=?

于 2013-07-06T03:15:58.647 回答