Ok, here we go.
In general, it's better to try and get as much from MySQL
as possible, as it is a lot faster than PHP!! So, we choose
the colour right in the SELECT clause itself. So no need for
any if statements anyway!
First of all, your SQL should now read ...
$query = "
SELECT *,
TO_DAYS(CURRENT_TIMESTAMP) - TO_DAYS(log_stamp) AS date,
IF(ISNULL(log_assign), 'FF0000', '666666') as txt_col
FROM call_logger
WHERE log_status LIKE 'open'
ORDER by log_stamp DESC
";
Then, goto the '//Process the new messages ' section.
In every TD replace the numbers only of the
font color value from ...
666666
... to exactly...
".$row["txt_col"]."
... including all surrounding double-quotes.
It should look like ...
//Process the new messages
while ($row = @ mysql_fetch_array($result))
{
//Print output for the log creator
echo "\n<tr>\n\t<td bgcolor=\"white\">" .
"<font color=\"#".$row["txt_col"]."\">" .
$row["log_creator" ] .
"</font></b></td>\n";
//Print output for the department
echo "\n\n\t<td bgcolor=\"white\">" .
"<font color=\"#".$row["txt_col"]."\">" .
$row["dept" ] .
"</font></b></td>\n";
//Print output for the log title
echo "\n\n\t<td bgcolor=\"white\">" .
"<font color=\"#".$row["txt_col"]."\">" .
$row["log_title" ] .
"</font></b></td>\n";
//Print output for the log status
echo "\n\n\t<td bgcolor=\"white\">" .
"<center><font color=\"#".$row["txt_col"]."\">" .
$row["log_status" ] .
"</font></b></td></center>\n";
//Print output for the log date
echo "\n\n\t<td bgcolor=\"white\">" .
"<center><font color=\"#".$row["txt_col"]."\">" .
$row["date" ] .
"</font></b></td></center>\n";
//Print output for the log_id
echo "\n\n\t<td bgcolor=\"white\" align=\"right\">" .
"<center><font color=\"#".$row["txt_col"]."\">" .
$row["log_id" ] .
"</font></b></td></center>\n";
Let me know how you get on.