From 743074b9df361a3eb07a10aabecbf16adf58486a Mon Sep 17 00:00:00 2001 From: lloydbayley Date: Wed, 3 May 2023 23:01:39 +1000 Subject: [PATCH] Update weekly_report.php --- scripts/weekly_report.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/weekly_report.php b/scripts/weekly_report.php index b28ef2e..e625d3a 100644 --- a/scripts/weekly_report.php +++ b/scripts/weekly_report.php @@ -210,7 +210,11 @@ while($detection=$result1->fetchArray(SQLITE3_ASSOC)) $totalcount = $result2->fetchArray(SQLITE3_ASSOC); $priorweekcount = $totalcount['COUNT(*)']; - $percentagediff = round( (($scount - $priorweekcount) / $priorweekcount) * 100 ); + if ($priorweekcount > 0) { + $percentagediff = round( (($scount - $priorweekcount) / $priorweekcount) * 100 ); + } else { + $percentagediff = 0; + } if($percentagediff > 0) { $percentagediff = "+".$percentagediff."%";