TagCloud log viewer

<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
     border: 1px solid black;
}
 
a {text-decoration: none}
</style>
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
<h1>Tag Cloud of Keywords (last 2500)</h1>
<br>
<?php
$servername = "localhost";
$username = "xxxxx";
$password = "xxxxx";
$dbname = "xxxxx";
 
require_once('HTML/TagCloud.php');
$tags = new HTML_TagCloud();
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
     die("Connection failed: " . $conn->connect_error);
}
 
$sql = "SELECT keywords, count(*) as NUM FROM keywords group by keywords limit 2500";
$result = $conn->query($sql);
 
if ($result->num_rows > 0) {
     
     // output data of each row
     while($row = $result->fetch_assoc()) {
$tags->addElement($row["keywords"] . ' (count:' . $row["NUM"] . ')', 'http://www.mohawksearch.com/perl/search.cgi?query=' . $row["keywords"], $row["NUM"]);
 
 
           
     }
 
print $tags->buildHTML();
     
} else {
     echo "0 results";
}
 
$conn->close();
?> 
 
</body>
</html>