我想加载一个评级图像,该图像取决于用户在某些测试中的平均分数。例如,如果用户得分在 5(不包括 5 )和 6(包括 6)之间,他应该得到图像 6.png,这是一个 3 星评级。
到目前为止,我尝试了这个,但它不起作用,似乎某处有错误。
Rating:
<? if ($row['AVG(answer)'] < 1): ?><img src='images/rating/0.png' hspace='3' style='vertical-align:middle;'><? endif;?>
<? if ($row['AVG(answer)'] == 1): ?><img src='images/rating/1.png' hspace='3' style='vertical-align:middle;'><? endif;?>
<? if ($row['AVG(answer)'] > 1 && <= 2): ?><img src='images/rating/2.png' hspace='3' style='vertical-align:middle;'><? endif;?>
<? if ($row['AVG(answer)'] > 2 && <= 3): ?><img src='images/rating/3.png' hspace='3' style='vertical-align:middle;'><? endif;?>
<? if ($row['AVG(answer)'] > 3 && <= 4): ?><img src='images/rating/4.png' hspace='3' style='vertical-align:middle;'><? endif;?>
<? if ($row['AVG(answer)'] > 4 && <= 5): ?><img src='images/rating/5.png' hspace='3' style='vertical-align:middle;'><? endif;?>
<? if ($row['AVG(answer)'] > 5 && <= 6): ?><img src='images/rating/6.png' hspace='3' style='vertical-align:middle;'><? endif;?>
<? if ($row['AVG(answer)'] > 6 && <= 7): ?><img src='images/rating/7.png' hspace='3' style='vertical-align:middle;'><? endif;?>
<? if ($row['AVG(answer)'] > 7 && <= 8): ?><img src='images/rating/8.png' hspace='3' style='vertical-align:middle;'><? endif;?>
<? if ($row['AVG(answer)'] > 8 && <= 9): ?><img src='images/rating/9.png' hspace='3' style='vertical-align:middle;'><? endif;?>
<? if ($row['AVG(answer)'] > 9 && <= 10): ?><img src='images/rating/10.png' hspace='3' style='vertical-align:middle;'><? endif;?>
有什么想法吗?