I’m Overlooking something

i am running ubuntu 22.04 and php 8.1 / MariaDB , i am missing somthing here in my code just can't see it. the premise of the code is to look at the TrolleyID Field and if it's '00000' basically echo's "BAD-READ" else it's 'GOOD-READ' any help would be great . thank you

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body>
<?php

$hostname = "localhost";
$username = "xxx";
$password = "xxx";
$db = "xxxxx";
$dbconnect=mysqli_connect($hostname,$username,$password,$db);

if ($dbconnect->connect_error) {
  die("Database connection failed: " . $dbconnect->connect_error);
}

?>

<table width="511" border="1" align="center">
<tr>
  <td width="133">Date</td>
  <td width="148">Time</td>
  <td width="208">TrolleyID</td>
  <td width="208">Status</td>
</tr>


        <?php
        while($res = mysqli_fetch_array($result)) {     

            $stat=$res['trolleyID'];
            if($stat=="000000")
            {
                $color="color:red";
                $text="BAD READ";
            }
            else 
            {
                $color="color:green";
                $text="GOOD READ";
            }

            echo "<tr>";
                echo "<td>".$res['datecol']."</td>";
                echo "<td>".$res['timecol']."</td>";
                echo "<td>".$res['trolleyID']."</td>";
                echo "<td style='$color'>".$text."</td>"; 
            echo "</tr>";

        }
        ?>

</table>
</body>
</html>