45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
PHP
<?php
|
|
include("config.php");
|
|
if (isset($_GET['tile']))
|
|
{
|
|
$tile = $_GET['tile'];
|
|
}
|
|
else
|
|
{
|
|
$tile = "None";
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<link rel="stylesheet" type="text/css" href="style.css"/>
|
|
</head>
|
|
<body padding="0" margin="0">
|
|
<?php
|
|
if ($tile == "None")
|
|
{
|
|
echo "No tile selected";
|
|
}
|
|
else
|
|
{
|
|
// Connect to DB
|
|
$con = new mysqli($SQL_SERVER, $SQL_USER, $SQL_PASSWORD, $SQL_DATABASE, $SQL_PORT);
|
|
if ($con->connect_error)
|
|
{
|
|
quit();
|
|
}
|
|
$stmt = $con->prepare("SELECT status.name AS status, COUNT(*) AS sCount, status.color AS color FROM secondLevel JOIN status ON secondLevel.status_id = status.id WHERE secondLevel.parent_id = (SELECT id FROM topLevel WHERE name = ?) GROUP BY status.id ORDER BY priority");
|
|
$stmt->bind_param("s", $tile);
|
|
$stmt->execute();
|
|
$result = $stmt->get_result();
|
|
$ret = $result->fetch_all(MYSQLI_ASSOC);
|
|
echo '<table border="1"><tr><td>Tile Name</td><td>' . $tile . '</td></tr>';
|
|
foreach ($ret as $row)
|
|
{
|
|
echo '<tr style="background-color: ' . $row["color"] . '"><td>' . $row["status"] . '</td><td>' . $row["sCount"] . '</td></tr>';
|
|
}
|
|
echo '</table>';
|
|
}
|
|
?>
|
|
</body>
|
|
</html>
|