diff --git a/analyze.py b/analyze.py index 6b4274c..4177070 100644 --- a/analyze.py +++ b/analyze.py @@ -270,9 +270,9 @@ def main(): sci_name,com_name = species.split('_') insert_variables_into_table(str(current_date), str(current_time), sci_name, com_name, \ str(entry[1]), str(args.lat), str(args.lon), str(min_conf), str(week), \ - str(sensitivity), str(args.overlap)) + str(args.sensitivity), str(args.overlap)) - print(str(current_date) + ';' + str(current_time) + ';' + entry[0].replace('_', ';') + ';' + str(entry[1]) +";" + str(args.lat) + ';' + str(args.lon) + ';' + str(min_conf) + ';' + str(week) + ';' + str(sensitivity) +';' + str(args.overlap) + '\n') + print(str(current_date) + ';' + str(current_time) + ';' + entry[0].replace('_', ';') + ';' + str(entry[1]) +";" + str(args.lat) + ';' + str(args.lon) + ';' + str(min_conf) + ';' + str(week) + ';' + str(args.sensitivity) +';' + str(args.overlap) + '\n') time.sleep(3) diff --git a/scripts/viewdb.php b/scripts/viewdb.php index be7cb55..0d0d979 100644 --- a/scripts/viewdb.php +++ b/scripts/viewdb.php @@ -1,18 +1,13 @@ connect_error) { die('Connect Error (' . $mysqli->connect_errno . ') '. @@ -20,8 +15,29 @@ if ($mysqli->connect_error) { } // SQL query to select data from database -$sql = "SELECT * FROM detections"; -$result = $mysqli->query($sql); +$sql = "SELECT * FROM detections + ORDER BY Date DESC, Time DESC"; +$fulltable = $mysqli->query($sql); +$totalcount=mysqli_num_rows($fulltable); + +$sql2 = "SELECT * FROM detections + 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)"; +$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"; +$specieslist = $mysqli->query($sql4); +$speciescount=mysqli_num_rows($specieslist); + $mysqli->close(); ?> @@ -30,25 +46,56 @@ $mysqli->close();
-