0

我如何对这样的事情进行 OR 查询?

//Query
$sql = "select `Friend_status` from `friendship_box` where 
`system_id` = '$sid' and `friend_id` = '$friendis' OR 
`system_id='$friendis' and `friend_id` = '$sid'";
$query = mysql_query($sql) or die ("Error: ".mysql_error());

while ($row = mysql_fetch_array($query)){
$activity = htmlspecialchars($row['Friend_status']);
}
mysql_free_result($query);
4

1 回答 1

2
select `Friend_status` from `friendship_box` 
where (`system_id` = '$sid' and `friend_id` = '$friendis')
OR (`system_id`='$friendis' and `friend_id` = '$sid')

你错过了`这里:

...OR (`system_id` <--
于 2012-05-06T19:20:22.957 回答