diff --git a/scripts/overview.php b/scripts/overview.php index e2912db..6425c18 100644 --- a/scripts/overview.php +++ b/scripts/overview.php @@ -1,4 +1,7 @@ connect_error) { } // SQL query to select data from database -$sql0 = "SELECT * FROM detections"; -$fulltable = $mysqli->query($sql0); -$totalcount = mysqli_num_rows($fulltable); +$sql0 = "SELECT COUNT(*) AS 'Total' FROM detections"; +$totalcount = $mysqli->query($sql0); $sql1 = "SELECT Com_Name, Date, Time FROM detections ORDER BY Date DESC, Time DESC LIMIT 1"; $mostrecent = $mysqli->query($sql1); -$sql2 = "SELECT * FROM detections +$sql2 = "SELECT COUNT(*) AS 'Total' FROM detections WHERE Date = CURDATE()"; -$todaystable = $mysqli->query($sql2); -$todayscount = mysqli_num_rows($todaystable); +$todayscount = $mysqli->query($sql2); - -$sql3 = "SELECT * FROM detections +$sql3 = "SELECT COUNT(*) AS 'Total' FROM detections WHERE Date = CURDATE() AND Time >= DATE_SUB(NOW(),INTERVAL 1 HOUR)"; -$lasthourtable = $mysqli->query($sql3); -$lasthourcount = mysqli_num_rows($lasthourtable); +$lasthourcount = $mysqli->query($sql3); -$sql4 = "SELECT Com_Name, Date, Time, MAX(Confidence) - FROM detections - WHERE Date = CURDATE() - GROUP BY Com_Name - ORDER BY MAX(Confidence) DESC"; -$specieslist = $mysqli->query($sql4); -$speciescount = mysqli_num_rows($specieslist); +$sql4 = "SELECT COUNT(Com_Name) AS 'Total' + FROM detections + WHERE Date = CURDATE()"; +$speciescount = $mysqli->query($sql4); $mysqli->close(); ?> @@ -104,9 +100,9 @@ while($rows=$mostrecent ->fetch_assoc()) Number of Detections - - - + fetch_assoc()) { echo $row['Total']; };?> + fetch_assoc()) { echo $row['Total']; };?> + fetch_assoc()) { echo $row['Total']; };?> @@ -114,7 +110,7 @@ while($rows=$mostrecent ->fetch_assoc()) - +
Species Detected Todayfetch_assoc()) { echo $row['Total']; };?>
@@ -122,7 +118,7 @@ while($rows=$mostrecent ->fetch_assoc())

Today's Top 10 Species

"; + echo ""; } else { echo "

No Detections For Today

"; }