if else语句有多个条件

时间:2012-12-10 00:28:17

标签: php if-statement

我尝试做的是在我的sql查询之前设置正确的变量。这是我创建的if语句但是我无法正确回显。下面提供的设置应该回显fnm但是回显出nm。我在这里错误地做了什么让每个if语句中的两个变量都匹配,所以我可以插入正确的数据

$type = "No Notification";
$remote = "Yes";
if ($type == "No Notification" && $remote == "No"){
$type = "nm";
}
elseif ($type == "Email Notification" && $remote == "No"){
$type = "m";
}
elseif ($type == "No Notifcation" && $remote == "Yes"){
$type = "fnm";
}
elseif ($type == "Email Notification" && $remote == "Yes"){
$type = "fm";
}
else {
$type = "nm";
}

echo $type;

1 个答案:

答案 0 :(得分:2)

您的第二个其他字​​母错误:通知通知 这些事情发生了:)