2021-04-09 19:21:53 +00:00
< ? 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 ();
}
2021-06-02 23:26:10 +00:00
$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 " );
2021-04-09 19:21:53 +00:00
$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 >