Set custom duration for minigraphs
This commit is contained in:
@@ -59,9 +59,11 @@ $totalspeciestally = $result6->fetchArray(SQLITE3_ASSOC);
|
|||||||
if(isset($_GET['comname'])) {
|
if(isset($_GET['comname'])) {
|
||||||
$birdName = htmlspecialchars_decode($_GET['comname'], ENT_QUOTES);
|
$birdName = htmlspecialchars_decode($_GET['comname'], ENT_QUOTES);
|
||||||
|
|
||||||
|
// Set default days to 30 if not provided
|
||||||
|
$days = isset($_GET['days']) ? intval($_GET['days']) : 30;
|
||||||
|
|
||||||
// Prepare a SQL statement to retrieve the detection data for the specified bird
|
// Prepare a SQL statement to retrieve the detection data for the specified bird
|
||||||
$stmt = $db->prepare('SELECT Date, COUNT(*) AS Detections FROM detections WHERE Com_Name = :com_name AND Date BETWEEN DATE("now", "-30 days") AND DATE("now") GROUP BY Date');
|
$stmt = $db->prepare('SELECT Date, COUNT(*) AS Detections FROM detections WHERE Com_Name = :com_name AND Date BETWEEN DATE("now", "-' . $days . ' days") AND DATE("now") GROUP BY Date');
|
||||||
|
|
||||||
// Bind the bird name parameter to the SQL statement
|
// Bind the bird name parameter to the SQL statement
|
||||||
$stmt->bindValue(':com_name', $birdName);
|
$stmt->bindValue(':com_name', $birdName);
|
||||||
|
|||||||
Reference in New Issue
Block a user