Reputation: 171
I am using mysql queries to fetch data from db. All my data are showing fine in tables. Now I want to color the 'ASR' column if the value is less than 30 . The below code is not working. Need help.
<?php
while ($report=$records->fetch_assoc()) {
echo "<tr>";
?><td style="border:1px solid #DCD6D6; text-align: center;>"<?php
echo "<td border='1'>".$report['Ingress']."</td>";
?><td style="border:1px solid #DCD6D6; text-align: center;>"<?php
echo "<td border='1'>".$report['Attempts']."</td>";
?><td style="border:1px solid #DCD6D6; text-align: center;>"<?php
if ($report['ASR'] < 30)
{
echo "<td border='1' color='red'>".$report['ASR']."</td>";
}
else
{ echo "<td border='1'>".$report['ASR']."</td>";
}
?>
Upvotes: 0
Views: 523
Reputation: 36609
color
is acss
property, usestyle
attribute and place values asstyle = "property : value"
Also note that value of the property is not suppose to be in the quotes all the time.
<?php
while ($report=$records->fetch_assoc()) {
echo "<tr>";
?><td style="border:1px solid #DCD6D6; text-align: center;>"<?php
echo "<td border='1'>".$report['Ingress']."</td>";
?><td style="border:1px solid #DCD6D6; text-align: center;>"<?php
echo "<td border='1'>".$report['Attempts']."</td>";
?><td style="border:1px solid #DCD6D6; text-align: center;>"<?php
if ($report['ASR'] < 30)
{
echo "<td border='1' style=\"color:red\">".$report['ASR']."</td>";
}
else
{ echo "<td border='1'>".$report['ASR']."</td>";
}
?>
Upvotes: 2