亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

if 語句替換 ECHO 中的某些內容

if 語句替換 ECHO 中的某些內容

PHP
子衿沉夜 2023-07-21 18:02:48
while ($rows=sqlsrv_fetch_array($stmt)){    $autoincrement++;    if ($rows[1] == 'ACROBAT')    {        $rows[1] = '<img src="img/class/icons/acrobat.png" height="60" width="60"> '.$rows[1].' <?php echo $rows[1];?>';    }    if ($rows[1] == 'PRIEST')    {        $rows[1] = '<img src="img/class/icons/priest.png" height="60" width="60"> '.$rows[1].' <?php echo $rows[1];?>';    }    if ($rows[1] == 'SWORDMASTER')    {        $rows[1] = '<img src="img/class/icons/swordsman.png" height="60" width="60"> '.$rows[1].' <?php echo $rows[1];?>';    }    if ($rows[1] == 'MERCENARY')    {        $rows[1] = '<img src="img/class/icons/mercenary.png" height="60" width="60"> '.$rows[1].' <?php echo $rows[1];?>';    }    if ($rows[1] == 'ALCHEMIST')    {        $rows[1] = '<img src="img/class/icons/alchemist.png" height="60" width="60"> '.$rows[1].' <?php echo $rows[1];?>';    }    echo '<tr id=io><td> '.$autoincrement.' </td><b> <td> <a style = "color:#AFA;" href="pvpprofile"> '.$rows[0].'</a> </td> </b> <td> '.$rows[1].'</td><td> '.$rows[2].' </td><!--  <td> '.$rows[3].' </td><td> '.$rows[4].' </td><td> '.$rows[5].' </td> --></tr>';  }如何用 if 語句替換底部的 $rows[1] ?我目前正在嘗試將圖標綁定到我的 sql 結果。我有大約 100 個案例,我認為這個 if 語句也不會非常有效,但盡管如此,我還是想了解如何實現添加這些圖標。TLDR:如何使我的 if 語句有效地進入最后一個 echo 語句?在此之前,我的 SQL 查詢中有大約 100 個案例,是否可以在其中打印 ECHO 語句并解決所有問題?
查看完整描述

1 回答

?
九州編程

TA貢獻1785條經驗 獲得超4個贊

答案是您無法通過關聯數組更改 SQL 結果。獲得我想要的結果的方法是修復 SQL 查詢本身并通過數據庫顯示圖像。



查看完整回答
反對 回復 2023-07-21
  • 1 回答
  • 0 關注
  • 135 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號