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 回答
- 0 關注
- 135 瀏覽
添加回答
舉報
0/150
提交
取消