aesthetic changes

This commit is contained in:
Patrick McGuire
2021-12-03 14:47:15 -05:00
parent 631b048fb8
commit e6d64c7819
4 changed files with 173 additions and 186 deletions
+96 -101
View File
@@ -10,45 +10,45 @@ $servername='localhost';
$mysqli = new mysqli($servername, $user, $password, $database);
if ($mysqli->connect_error) {
die('Connect Error (' .
$mysqli->connect_errno . ') '.
$mysqli->connect_error);
die('Connect Error (' .
$mysqli->connect_errno . ') '.
$mysqli->connect_error);
}
// SQL query to select data from database
$sql = "SELECT * FROM detections
ORDER BY Date DESC, Time DESC";
ORDER BY Date DESC, Time DESC";
$fulltable = $mysqli->query($sql);
$totalcount=mysqli_num_rows($fulltable);
$sql1 = "SELECT * FROM detections
WHERE Date = CURDATE()
ORDER BY Date DESC, Time DESC";
WHERE Date = CURDATE()
ORDER BY Date DESC, Time DESC";
$mosttable = $mysqli->query($sql1);
$sql2 = "SELECT * FROM detections
WHERE Date = CURDATE()";
WHERE Date = CURDATE()";
$todaystable = $mysqli->query($sql2);
$todayscount=mysqli_num_rows($todaystable);
$sql3 = "SELECT * FROM detections
WHERE Date = CURDATE()
AND Time >= DATE_SUB(NOW(),INTERVAL 1 HOUR)";
WHERE Date = CURDATE()
AND Time >= DATE_SUB(NOW(),INTERVAL 1 HOUR)";
$lasthourtable = $mysqli->query($sql3);
$lasthourcount=mysqli_num_rows($lasthourtable);
$sql4 = "SELECT Com_Name, Date, Time, MAX(Confidence)
FROM detections
GROUP BY Com_Name
ORDER BY MAX(Confidence) DESC";
FROM detections
GROUP BY Com_Name
ORDER BY MAX(Confidence) DESC";
$specieslist = $mysqli->query($sql4);
$speciescount=mysqli_num_rows($specieslist);
$sql5 = "SELECT Com_Name,COUNT(*)
AS Total
FROM detections
GROUP BY Com_Name
ORDER BY Total DESC";
AS Total
FROM detections
GROUP BY Com_Name
ORDER BY Total DESC";
$speciestally = $mysqli->query($sql5);
$mysqli->close();
@@ -58,122 +58,117 @@ $mysqli->close();
<html lang="en">
<head>
<meta charset="UTF-8">
<!-- <meta name="viewport" content="width=device-width, initial-scale=1"> -->
<title>BirdNET-Pi DB</title>
<!-- CSS FOR STYLING THE PAGE -->
<link rel="stylesheet" href="style.css">
<style>
</style>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>BirdNET-Pi DB</title>
<link rel="stylesheet" href="style.css">
</head>
<body style="background-color: rgb(119, 196, 135);background-image: linear-gradient(to top, rgb(119, 196, 135),black;">
<body style="background-color: rgb(119, 196, 135);">
<section>
<section>
<h2>Number of Detections</h2>
<div class="row">
<div cladd="column" style="width: 75%;padding-left: 15%;">
<h2>Number of Detections</h2>
<table>
<tr>
<th>Total</th>
<th>Today</th>
<th>Last Hour</th>
<th>Number of Unique Species</th>
</tr>
<tr>
<td><?php echo $totalcount;?></td>
<td><?php echo $todayscount;?></td>
<td><?php echo $lasthourcount;?></td>
<td><?php echo $speciescount;?></td>
</tr>
</table>
<div class="column2">
<table>
<tr>
<th>Total</th>
<th>Today</th>
<th>Last Hour</th>
<th>Number of Unique Species</th>
</tr>
<tr>
<td><?php echo $totalcount;?></td>
<td><?php echo $todayscount;?></td>
<td><?php echo $lasthourcount;?></td>
<td><?php echo $speciescount;?></td>
</tr>
</table>
</div>
</div>
</table>
</div>
</div>
<h2>Today's Detections</h2>
<!-- TABLE CONSTRUCTION-->
<table>
<tr>
<th>Time</th>
<th>Scientific Name</th>
<th>Common Name</th>
<th>Confidence</th>
<th>Lat</th>
<th>Lon</th>
<th>Cutoff</th>
<th>Week</th>
<th>Sens</th>
<th>Overlap</th>
</tr>
<!-- PHP CODE TO FETCH DATA FROM ROWS-->
<h2>Today's Detections</h2>
<!-- TABLE CONSTRUCTION-->
<table>
<tr>
<th>Time</th>
<th>Scientific Name</th>
<th>Common Name</th>
<th>Confidence</th>
<th>Lat</th>
<th>Lon</th>
<th>Cutoff</th>
<th>Week</th>
<th>Sens</th>
<th>Overlap</th>
</tr>
<!-- PHP CODE TO FETCH DATA FROM ROWS-->
<?php // LOOP TILL END OF DATA
while($rows=$mosttable ->fetch_assoc())
{
?>
<tr>
<!--FETCHING DATA FROM EACH
ROW OF EVERY COLUMN-->
<td><?php echo $rows['Time'];?></td>
<td><?php echo $rows['Sci_Name'];?></td>
<td><?php echo $rows['Com_Name'];?></td>
<td><?php echo $rows['Confidence'];?></td>
<td><?php echo $rows['Lat'];?></td>
<td><?php echo $rows['Lon'];?></td>
<td><?php echo $rows['Cutoff'];?></td>
<td><?php echo $rows['Week'];?></td>
<td><?php echo $rows['Sens'];?></td>
<td><?php echo $rows['Overlap'];?></td>
</tr>
<tr>
<!--FETCHING DATA FROM EACH
ROW OF EVERY COLUMN-->
<td><?php echo $rows['Time'];?></td>
<td><?php echo $rows['Sci_Name'];?></td>
<td><?php echo $rows['Com_Name'];?></td>
<td><?php echo $rows['Confidence'];?></td>
<td><?php echo $rows['Lat'];?></td>
<td><?php echo $rows['Lon'];?></td>
<td><?php echo $rows['Cutoff'];?></td>
<td><?php echo $rows['Week'];?></td>
<td><?php echo $rows['Sens'];?></td>
<td><?php echo $rows['Overlap'];?></td>
</tr>
<?php
}
?>
</table><div class="row">
</table>
<div class="row">
<div class="column">
<h2>Detected Species</h2>
<table>
<tr>
<th>Species</th>
<th>Date</th>
<th>Time</th>
<th>Max Confidence Score</th>
</tr>
<h3>Detected Species</h3>
<table>
<tr>
<th>Species</th>
<th>Date</th>
<th>Time</th>
<th>Max Confidence Score</th>
</tr>
<?php // LOOP TILL END OF DATA
while($rows=$specieslist ->fetch_assoc())
{
?>
<tr>
<td><?php echo $rows['Com_Name'];?></td>
<td><?php echo $rows['Date'];?></td>
<td><?php echo $rows['Time'];?></td>
<td><?php echo $rows['MAX(Confidence)'];?></td>
<tr>
<td><?php echo $rows['Com_Name'];?></td>
<td><?php echo $rows['Date'];?></td>
<td><?php echo $rows['Time'];?></td>
<td><?php echo $rows['MAX(Confidence)'];?></td>
</tr>
</tr>
<?php
}
?>
</table>
</table>
</div>
<div class="column">
<h2>Species Statistics</h2>
<table>
<tr>
<th>Species</th>
<th>Detections</th>
</tr>
<h3>Species Statistics</h3>
<table>
<tr>
<th>Species</th>
<th>Detections</th>
</tr>
<?php // LOOP TILL END OF DATA
while($rows=$speciestally ->fetch_assoc())
{
?>
<tr>
<td><?php echo $rows['Com_Name'];?></td>
<td><?php echo $rows['Total'];?></td>
</tr>
<tr>
<td><?php echo $rows['Com_Name'];?></td>
<td><?php echo $rows['Total'];?></td>
</tr>
<?php
}
?>
</section>
</div>
</section>
</html>