<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Download Counters</title>
</Head>
<body>
<?php
require_once("Downloader.inc");    // Include the database login information
$hits = 0;
$SQL = "SELECT * FROM $tablename ORDER BY Collateral, Type" ;
$stmt = $conn->prepare($SQL);
try {
   $stmt->execute();
}
catch(PDOException $e)
    {
    echo $SQL . "<br>" . $e->getMessage();
    }
echo '<h3>Download Counters</h3>';
echo '<center><Table border="1" id="table3" style="margin:1em auto;">
    <tr>
        <th style="width:50%; color: #CFCFCF; text-align: center; background-color: #4C4C4C">Collateral</th>
        <th style="width:20%; color: #CFCFCF; text-align: center; background-color: #4C4C4C">Downloads</th>
        <th style="width:20%; color: #CFCFCF; text-align: center; background-color: #4C4C4C">Last Download</th>
    </tr> ';
while($row=$stmt->fetch(PDO::FETCH_ASSOC))  {
    $hits = $hits + $row['DownloadCount'] ;
    echo "<tr><td style='color: #323232 background-color: #EEEEEE'>" . $row['Collateral'] . "." . $row['Type'] . "</td><td style='color: #323232 background-color: #EEEEEE'>" . $row['DownloadCount'] . "</td><td style='color: #323232 background-color: #EEEEEE'>" . $row['LastDownload'] . "</TD></TR>";
}
echo '</center></table><span style="font-size: medium"><center>Total number of hits = ' . $hits . '</center></span>' ;
$conn = null;
?>
</body></html>