2012-12-10 253 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