This is a partial of the code I have on my script. I have tried to make the backgrounds change color depending on the values and can't get it to read the arrays correct. Placing the conditions outside the while or inside the while returns same results when printed.
If the value is 100, the color should be RED
If the value is above 49, the color will be yellow
If the value is 0 to 49, the color will be green
Will appreciate if someone would find how the BILLED_TO_DATE_PERCENTAGE would change depending on number range when SQL read pulls data.
$counter = 1;
while($row = mysqli_fetch_array($result))
{
if($BILLED_TO_DATE_PERCENTAGE = 100)
{
$tdStyle='background-color:red;';
}
else
{
if($BILLED_TO_DATE_PERCENTAGE > 79)
{
$tdStyle='background-color:yellow;';
}
else
{
$tdStyle='background-color:green;';
}
}
echo "<tr>";
echo "<td bgcolor=#001F25>" . "<b>" . "<font color=WHITE>" . $counter . "</font>" . "</b>" . "</td>";
echo "<td bgcolor=#00353F>" . "<b>" . "<font color=WHITE>" . $row['NUMBER'] . "</font>" . "</td>";
echo "<td bgcolor=#00353F>" . "<b>" . "<font color=WHITE>" . $row['PROJECT'] . "</font>" . "</td>";
echo "<td style=\"$tdStyle\">" . "<b>" . "<i>" . $row['BILLED_TO_DATE_PERCENTAGE'] . "</i>" . "</b>" . "</td>";
echo "</tr>";
$counter++; //increment counter by 1 on every pass
}
echo "</table>";