我正在尝试删除数据库中的跟随关系。我想用一个查询执行一个代码,删除我所遵循的代码,也反过来。我有以下代码有语法错误:
//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 :(得分:0)
您忘记为$profileId
添加结束'单引号。
试试这个
$sql = "
DELETE FROM contactlists
WHERE (profileId = '$profileId' AND contactsProfileId = '$contactsProfileId')
OR (profileId = '$contactsProfileId' AND contactsProfileId = '$profileId')
";
答案 1 :(得分:0)
首先查看$profileId
:
//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')
"