I’m pulling a table from a MySQL database, using PHP.
This is roughly the code I’m using, obviously I’ve got more columns, but this is the demo version of the code.
As you can see, the code is ordered by the Sales Name. Now what I want to do is, show a little icon next to the top ten sellers based on the Sales Count.
So, if a Sales Count is one of the top ten figures, it must show a little image next to it’s name.
Can this be done?
<?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>";
?>
Yes you can do it: