2013-07-06 2 views
1

쿼리 DELETE는 항상 삭제 필드를 지정하여 전체 행을 삭제PDO의 MySQL erorr 1064

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 

답변

2

DELETE * FROM BlogPosts WHERE Id=? 

(echo'd 등) 오류가 이해되지 않는다.

당신이 원하는 :

DELETE FROM BlogPosts WHERE Id=? 
+0

미안, 나는'*'제거하기 전에 사고로 저장 히트 - 결정된. –

+0

+1 b/c 모두 대답했지만 논리를 발표했습니다. –

2

당신은 당신이 모든 행 삭제 한 * 필요하지 않습니다 :

DELETE FROM BlogPosts WHERE Id=?

+0

감사합니다. 완벽하게 작업했습니다. – user1763295