Good Day,
I'm trying to changed the background color of a field based on the results of the field. My script runs fine and provides the data correctly.
I query my database and it gives me a result of $priority. $priority can be High, Medium, or Low. What I want is: If $priority is "Low", background color "Blue", $priority is "High", background color is "Red".
I'm not sure how to write the if statement in order to change a background color. Here is a snippit of my code
$query = "SELECT workorder.*, tech.techname FROM workorder RIGHT JOIN tech ON workorder.techid = tech.techid WHERE status='Open' ORDER BY date asc LIMIT $offset,$recordsperpage";
$result = mysql_query($query) or die('Could not retrieve workorders');
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$woid = $row['woid'];
$priority = $row['priority'];
$date = $row['date'];
$problem = $row['problem'];
$techid = $row['techid'];
$techname = $row['techname'];
$userid = $row['userid'];
$deptcode = $row['deptcode'];
echo "<tr><td><h3><center>\n";
echo $woid . "\n";
echo "</h3></td><td><center>\n";
echo $priority . "\n";
echo "</center></td><td>\n";
echo $date . "\n";
echo "</td><td>\n";
When I "echo $priority" I want the background color based on the data $priority provides. There are 6 possible results for $priority.
Can someone point me in the right direction?
thanks.