Hello Guys,
I have a column named message_status it can only have the values "read" or "unread" in it. I would like to show an image in the column next to it. If the message is "read" then I would like to display a green dot, and if it is unread I would like to display a red dot. I would also like to be able to have anything in the row that's "unread" to appear in bold. I completely stumped by this! I have written the following code, which doesn't seem to work, presumably because it is run after the table has been displayed? I am very new to this so please be gentle!
Regards,
AJLX
$result = mysql_query("SELECT * FROM messages where username ='$username'ORDER BY {$_GET['orderbycol']} $sort");
echo "<table border='1'>
<tr width='200'>
<th>View</th>
// code to display table removed
</tr>";
$green_dot = $message_status;
$red_dot = $message_status;
$green = "";
$red = "";
$bold = "";
while ($row = mysql_fetch_array($result))
{
echo "<tr>";
$id = $row['ID'];
echo "<td><a href='/view_message.php/?view_message=$id'>View</a></td>";
echo "<td>" .$green . $red."</td>";
echo "<td>" .$bold . $message_status = $row['message_status'] . "</td>";
echo "<td>" .$bold. $row['date_sent'] . "</td>";
echo "<td>" .$bold. $row['contact_name'] . "</td>";
echo "<td>" .$bold. $row['subject'] . "</td>";
echo "</tr>";
}
if ($green_dot = 'read'){
$green ='<img src=\"assets/red.jpg\"/>';
echo $green;
} else {
$red ='<img src=\"assets/red.jpg\"/>';
$bold = "<b>";
echo $red;