2011-04-20 3 views
0

내 데이터베이스에서 follow-relation을 삭제하려고합니다. 하나의 쿼리를 사용하여 내가 따르는 코드와 반대 방향의 코드를 모두 제거하는 코드를 실행하고 싶습니다.sql : syntax error를 사용하여 contactslist의 follow-relation을 제거 하시겠습니까?

//profileId is the current user and contactsProfileId which user he/she follows 
$sql = " 
DELETE FROM contactlists 
WHERE (profileId = '$profileId AND contactsProfileId = '$contactsProfileId') 
OR (profileId = '$contactsProfileId' AND contactsProfileId = '$profileId') 
"; 

답변

0

당신은 $profileId에 대한 폐쇄 '작은 따옴표를 추가하는 것을 잊었다 : I에 구문 오류가 다음 코드를 가지고있다.

$profileId에서이

$sql = " 
DELETE FROM contactlists 
WHERE (profileId = '$profileId' AND contactsProfileId = '$contactsProfileId') 
OR (profileId = '$contactsProfileId' AND contactsProfileId = '$profileId') 
"; 
+0

확인 조금 장님이 있었다 – einstein

0

살펴보십시오)

//profileId is the current user and contactsProfileId which user he/she follows 
$sql = " 
DELETE FROM contactlists 
WHERE (profileId = '$profileId' AND contactsProfileId = '$contactsProfileId') 
OR (profileId = '$contactsProfileId' AND contactsProfileId = '$profileId') 
" 
관련 문제