2012-12-10 196 views
0

什么,我试图做我的SQL查询之前设置正确的变量。这是我创建的if语句,但我无法正确回显。下面提供的设置应该回显出fnm,但是会回显nm。我在做什么错误这里有两个变量匹配每个if语句,所以我可以插入正确的数据如果有多个条件else语句

$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; 
+0

什么'的var_dump($型); var_dump($ remote);'display? (在你的代码的开头添加行) – Jocelyn

+0

字符串(2)“纳米”串(3)“是” –

+3

错字:** ** Notifcation缺少我 –

回答

2

你的第二个ELSEIF有一个错字:Notifcation应该通知 这些事情发生:)

+0

漂亮的眼睛。花了我一段时间来看看。 – Kinz