I have developed a simple chat system. I am trying to make the admin color red to stand out among the chat users. My method takes the session username and if the session username is the admin then it turns everyone's text color red. How can I make it so only the admin color is red (everyone else is black)?
Here is my php code:
<?php
error_reporting(E_ALL & ~E_NOTICE);
session_start();
if (isset($_SESSION['id'])) {
$userId = $_SESSION['id'];
$username = $_SESSION['username'];
$userLabel = $_SESSION['nickname'];
}
$connect = mysqli_connect("", "", "", "root");
mysqli_select_db($connect, "webclyde_root");
$result1 = mysqli_query($connect, "SELECT * FROM chat ORDER by id DESC");
while ($extract = mysqli_fetch_assoc($result1)) {
if ($username == "admin") {
echo "<br><b><font color='#D00003'>" . $extract['name'] . ":</b></font> " . $extract['message'];
}
else {
echo "<br><b><font color='#000000'>" . $extract['name'] . ":</b></font> " . $extract['message'];
}
}
?>