看板 Web_Design 關於我們 聯絡資訊
我剛剛在執行if else 語句時 一直出現 Parse error: syntax error, unexpected T_ELSE 這個問題 以下是我的原始碼 <td> <div class="name"> <span class="ts"> <?php if($row_rscardoc['position_firemember']=="小隊長") {echo 小隊長;}?> </span> <?php else($row_rscardoc['position_firemember']!="小隊長") {echo $row_rscardoc['position_firemember'] $row_rscardoc['username'];}?> </div></td> 我怎麼找都找不出我錯哪裡 可以麻煩各位大大幫幫我嗎 Orz~c=3 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.184.237.148 ※ 文章網址: http://www.ptt.cc/bbs/Web_Design/M.1418873170.A.B03.html
crossdunk: ELSE改IF 12/18 11:37
crossdunk: ECHO 小隊長 要變成 '小隊長' 12/18 11:38
crossdunk: PHP 兩個變數要字串相加中間要用. 12/18 11:39
Peruheru: else後面不能加條件,因為else就是"其他情況"的意思 12/18 11:44
Peruheru: 你想另外判斷,就要用"else if" 或是另外在else裡面寫if 12/18 11:45