I need to generate a simple table with dynamically coloured <td>
's based on mysql retrieved values.
Here is what I need:
$target = 20;
$achieved = 13;
echo "<table border='1'><tr>";
for($i = 0; $i <= $target; $i++){
echo "<td></td>";
}
echo "</tr></table>";
The above code plots a table with no of <td>
's equal to $target
. All I need is then to color the background of these <td>
's with the value inside variable $achieved
. So in this case I want 13 colored <td>
's.