Php 是否可以在IF条件中添加参数?

Php 是否可以在IF条件中添加参数?,php,if-statement,Php,If Statement,我想显示表中的数据。某些用户可能只有某些数据。我有一个参数: if($person == "nonmember"){ $st_show = ' == 3'; //For non member show rows with status of 3 }else{ $st_show = ' <> 3'; //For member show rows with status of not 3. Status may dynamically increased and chan

我想显示表中的数据。某些用户可能只有某些数据。我有一个参数:

if($person == "nonmember"){
    $st_show = ' == 3'; //For non member show rows with status of 3
}else{
    $st_show = ' <> 3'; //For member show rows with status of not 3. Status may dynamically increased and changed
}
我知道它返回了一个错误。除了数据库中的这些限制之外,还有什么解决方案吗?

类似于

if(($person == "nonmember" && $status == 3) || 
          ($person == "member" && $status <> 3)){
   // Show record
}
if($person==“nonmember”&&&$status==3)|
($person==“成员”&&&$status 3)){
//显示记录
}

使用必需的条件从数据库中选择行。@u\u mulder我正在寻找仅适用于PHP的解决方案似乎您想在SQL上设置条件,而不是在SQL中设置条件PHP@MasivuyeCokile你说得对。这个很好用。非常感谢。
if(($person == "nonmember" && $status == 3) || 
          ($person == "member" && $status <> 3)){
   // Show record
}