对于“ProspectStatus”字段,我可以从mysql 的表/列中显示三个值,RED,GREEN,YELLOW
无论如何我可以让单元格根据值更改其背景颜色吗?
例如
echo "<td>" . $row['ProspectStatus'] . "</td>";
PHP代码:
$result = mysql_query("SELECT * FROM customerdetails");
//List the Columns for the Report
echo "<table border='1'>
<tr>
<th>CustomerID</th>
<th>Customer Name</th>
<th>Prospect Status</th>
<th>Address</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['CustomerID'] . "</td>";
echo "<td>" . $row['CustomerName'] . "</td>";
echo "<td>" . $row['ProspectStatus'] . "</td>"; //this is the field I want to show either RED, GREEN or YELLOW
echo "<td>" . $row['Address'] . "</td>";
echo "</tr>";
}
echo "</table>";