我使用PHP从MySQL数据库中提取表。在PHP中显示来自MySQL的结果旁边的图像?
这大致是我使用的代码,显然我有更多的列,但这是代码的演示版本。
如您所见,代码按销售名称排序。现在我想要做的是,根据销售计数在前十名卖家旁边显示一个小图标。 因此,如果销售计数是前十位数字之一,则必须在名称旁显示一个小图片。
可以这样做吗?
<?php
// Get all the data from the "sales" table
$result = mysql_query("SELECT * FROM sales ORDER BY SalesName") or die(mysql_error());
echo "<table border='1'>";
echo "<tr> <th>Sales Name</th> <th>Sales Count</th> </tr>";
while($row = mysql_fetch_array($result)) {
echo "<tr><td>";
echo $row['SalesName'];
echo "</td><td>";
echo $row['SalesCount'];
echo "</td></tr>";
}
echo "</table>";
?>