diff --git a/scripts/todays_detections.php b/scripts/todays_detections.php index 2f25575..475e000 100644 --- a/scripts/todays_detections.php +++ b/scripts/todays_detections.php @@ -58,11 +58,16 @@ $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\') ORDER BY Time DESC LIMIT '.(intval($_GET['display_limit'])-40).',40'); + $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\') ORDER BY Time DESC '); + $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"; @@ -151,7 +156,7 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" ) { -

Today's Detections

+

Today's Detections —

@@ -160,6 +165,22 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" ) {