I made a search feature for my web page, but my table seemed to be overlapping. Here is how the table looks like when I search for the word "server" which appears in three rows

If you see my results the headers are repeating and overlapping.
This is my code I really do not know were I'm making mistakes.
<?php
include 'includes/connect.php';
$query = $_GET['query'];
$min_length = 3;
if (strlen($query) >= $min_length) {
    $query = htmlspecialchars($query);
    $query = mysql_real_escape_string($query);
    $raw_results = mysql_query("SELECT * FROM aggrement
                WHERE (`id` LIKE '%" . $query . "%') OR(`description` LIKE '%" . $query . "%') OR (`start_date` LIKE '%" . $query . "%') OR (`end_date` LIKE '%" . $query . "%') OR (`balance` LIKE '%" . $query . "%') OR (`tax_value` LIKE '%" . $query . "%') OR (`amount_paid` LIKE '%" . $query . "%') OR (`hosting_name` LIKE '%" . $query . "%') OR (`domain_name` LIKE '%" . $query . "%') OR (`first_name` LIKE '%" . $query . "%') OR (`last_name` LIKE '%" . $query . "%')") or die(mysql_error());
    if (mysql_num_rows($raw_results) > 0) {
        echo "<table>";
        // echo your header row here
        while ($results = mysql_fetch_array($raw_results)) {
            echo "<tr>
          <th>Id</th>
          <th><a href='viewaggrement.php?sort=description'>Description</th>
          <th><a href='viewaggrement.php?sort=start_date'>Start Date</th>
          <th><a href='viewaggrement.php?sort=end_date'>End Date</th>
          <th><a href='viewaggrement.php?sort=balance'>Balance</th>
          <th><a href='viewaggrement.php?sort=tax_value'>Tax </th>
          <th><a href='viewaggrement.php?sort=amount_paid'>Amount Paid</th>
         <th><a href='viewaggrement.php?sort=domain_name'>Domain Name</th>
         <th><a href='viewaggrement.php?sort=hosting_name'>Hosting Name</th>
        <th><a href='viewaggrement.php?sort=first_name'>First Name</th>
        <th><a href='viewaggrement.php?sort=last_name'>Last Name</th>
        <th>Edit</th>
        <th>Delete</th>
        </tr>";
            echo "<tr>";
            echo "<td>" . $results['id'] . "</td>";
            echo "<td>" . $results['description'] . "</td>";
            echo "<td>" . $results['start_date'] . "</td>";
            echo "<td>" . $results['end_date'] . "</td>";
            echo "<td>" . $results['balance'] . "</td>";
            echo "<td>" . $results['tax_value'] . "</td>";
            echo "<td>" . $results['amount_paid'] . "</td>";
            echo "<td>" . $results['hosting_name'] . "</td>";
            echo "<td>" . $results['domain_name'] . "</td>";
            echo "<td>" . $results['first_name'] . "</td>";
            echo "<td>" . $results['last_name'] . "</td>";
            echo '<td><b><a href="editaggrement.php?id=' . $results['id'] . '"><img src="images/icons/glyphicons_030_pencil.png" /></a></b></td>';
            echo '<td><b><a href="deleteaggrement.php?id=' . $results['id'] . '"><img src="images/icons/glyphicons_016_bin.png" /></a></b></td>';
            echo "</tr>";
        }
        echo "</table>";
    } else {
        echo "No results";
    }
} else {
    echo "Minimum length is " . $min_length;
}
?>
 
     
     
    