I want to output data into row without repeating the table head information

i want to try and output a data from database with some conditions but it keeps repeating the table head information along with it also i dont want the table to show on my applications if there is no data .please kindly help.

<?php
$query= "select *from `exitform`;";
if(count(fetchAll($query))>0){
    foreach(fetchAll($query)as $row){
        if($_SESSION['lm_name']==$row['manager']){                                                                             
            if($row['Dams']==Null and $row['empname']!=NULL){
    ?>                                     
    <div class="container">  
        <table class= "table">
        <thead>
            <th scope = "col">SI no</th>
            <th scope = "col">Employee Name </th>
            <th scope = "col"> Status Information </th>
            <center><th Scope = "col">  </th></center>
            <th scope = "col"> Date </th>
        </thead>
    </div>                                                    
        <td><?php echo $row['id'] ?>'</td>
        <td><?php echo $row['empname'] ?></td>
        <td><?php echo $row['message'] ?><td>
        <td><i><?php echo $row['date'] ?></i><td>
        <td><a href="linemanager.php?id=<?php echo $row['id']?>" 
            class="btn btn-primary my-2">Pending request</a></td>
    
    <?php

the code above is to output the data into the table , it worked but it was also repeating the table head information , how can it be rectified . kindly advice me on what to do.

this is the output

**SI no     Employee Name   Status Information                      Date**
87'     Kemi Adetiba    Kemi Adetiba is awaiting your approval      2022-11-21 08:49:46     
Pending request
**SI no     Employee Name    Status Information         Date**
88'     Alex        Alex is awaiting your approval  2022-11-21 08:50:56     
Pending request

but i don’t want the table head information to be duplicated