prepare('SELECT COUNT(*) FROM detections'); if($statement1 == False){ echo "Database is busy"; header("refresh: 0;"); } $result1 = $statement1->execute(); $totalcount = $result1->fetchArray(SQLITE3_ASSOC); $statement2 = $db->prepare('SELECT COUNT(*) FROM detections WHERE Date == DATE(\'now\', \'localtime\')'); if($statement2 == False){ echo "Database is busy"; header("refresh: 0;"); } $result2 = $statement2->execute(); $todaycount = $result2->fetchArray(SQLITE3_ASSOC); $statement3 = $db->prepare('SELECT COUNT(*) FROM detections WHERE Date == Date(\'now\', \'localtime\') AND TIME >= TIME(\'now\', \'localtime\', \'-1 hour\')'); if($statement3 == False){ echo "Database is busy"; header("refresh: 0;"); } $result3 = $statement3->execute(); $hourcount = $result3->fetchArray(SQLITE3_ASSOC); $statement4 = $db->prepare('SELECT Com_Name, Sci_Name, Time, Confidence FROM detections LIMIT 1'); if($statement4 == False){ echo "Database is busy"; header("refresh: 0;"); } $result4 = $statement4->execute(); $mostrecent = $result4->fetchArray(SQLITE3_ASSOC); $statement5 = $db->prepare('SELECT COUNT(DISTINCT(Com_Name)) FROM detections WHERE Date == Date(\'now\', \'localtime\')'); if($statement5 == False){ echo "Database is busy"; header("refresh: 0;"); } $result5 = $statement5->execute(); $todayspeciestally = $result5->fetchArray(SQLITE3_ASSOC); $statement6 = $db->prepare('SELECT COUNT(DISTINCT(Com_Name)) FROM detections'); if($statement6 == False){ echo "Database is busy"; header("refresh: 0;"); } $result6 = $statement6->execute(); $totalspeciestally = $result6->fetchArray(SQLITE3_ASSOC); if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" ) { if(isset($_GET['searchterm'])) { $searchquery = "AND (Com_name LIKE '%".$_GET['searchterm']."%' OR Sci_name LIKE '%".$_GET['searchterm']."%' OR Confidence LIKE '%".$_GET['searchterm']."%' OR File_Name LIKE '%".$_GET['searchterm']."%' OR Time LIKE '%".$_GET['searchterm']."%')"; } else { $searchquery = ""; } if(isset($_GET['display_limit']) && is_numeric($_GET['display_limit'])){ $statement0 = $db->prepare('SELECT Time, Com_Name, Sci_Name, Confidence, File_Name FROM detections WHERE Date == Date(\'now\', \'localtime\') '.$searchquery.' ORDER BY Time DESC LIMIT '.(intval($_GET['display_limit'])-40).',40'); } else { // legacy mode $statement0 = $db->prepare('SELECT Time, Com_Name, Sci_Name, Confidence, File_Name FROM detections WHERE Date == Date(\'now\', \'localtime\') '.$searchquery.' ORDER BY Time DESC '.$searchquery); } if($statement0 == False){ echo "Database is busy"; header("refresh: 0;"); } $result0 = $statement0->execute(); ?>
| Total | Today | Last Hour | Unique Species Total | Unique Species Today |
|---|---|---|---|---|