<div class="container">
<table class="table table-striped table-bordered table-hover table-responsive">
  <tr>
    <th>SL</th>
    <th>Type</th>
    <th>AC No</th>
    <th>Name</th>
    <th>Account Creation Date</th>
    <th>Maturity Value</th>
    <th>Balance</th>
    <th>No Of Installment</th>
    <th>No Of Paid Installment</th>
    <th>Installment Amount</th>
  </tr>
  <?php
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

$sql = "SELECT * FROM `" . $GLOBALS['arif_ac'] . "` WHERE `AA_BAL` < 0 ORDER BY `AA_ID` DESC";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    while ($row = $result->fetch_assoc()) {
        //$ID=$row["GC_ID"];
        $tt = $row["AA_ID"] - 10;
        echo "
          <tr>
            <td>" . $tt . "</td>                
            <td>" . $row["AA_ACTYPE"] . "," . $row["AA_TYPE"] . "</td>
            <td><a href='./Details?no=" . $row["AA_ACNO"] . "&type=" . $row["AA_TYPE"] . "'>" . $row["AA_ACNO"] . "</a> &nbsp;&nbsp; <a href='./Trans_New?no=" . $row["AA_ACNO"] . "&type=" . $row["AA_TYPE"] . "'>Transact</a></td>
            <td>" . $row["AA_NAME"] . "</td>
            <td>" . $row["AA_DATE"] . "</td>
            <td>" . $row["AA_MATURE_VALUE"] . "</td>
            <td>" . $row["AA_BAL"] . "</td>
            <td>" . $row["AA_NO_OF_PAYMENT"] . "</td>
            <td>" . $row["AA_NO_OF_PAYPAID"] . "</td>
            <td>" . $row["AA_INSTALLMENT"] . "</td>
          </tr>";
    }
} else {
    echo "0 results";
};
$conn->close();
?>