From 8ee6fb318513c4f5d4b74631d5c439010beb33f5 Mon Sep 17 00:00:00 2001 From: Walter Hupfeld Date: Sat, 5 Sep 2020 17:36:49 +0200 Subject: [PATCH] statistics 2 --- css/style.css | 4 +++- lib/functions.php | 40 ++++++++++++++++++++++++++++++++++------ 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/css/style.css b/css/style.css index 630c0e9..d75120d 100644 --- a/css/style.css +++ b/css/style.css @@ -90,4 +90,6 @@ i.wa { left: 50%; z-index: 1000; display:none; -} \ No newline at end of file +} + +.statistik td, th {border: 1px solid grey; font-size: smaller;} \ No newline at end of file diff --git a/lib/functions.php b/lib/functions.php index 31381fb..ec4d551 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -87,6 +87,8 @@ function nl2br2($string) { function get_statistics($numVehicle,$strWhere) { global $db; + global $arrUnfallart; + global $arrUnfalltyp; $strSQL="SELECT sum(IstRad) as rad, sum(IstPKW) as pkw, @@ -107,8 +109,8 @@ function nl2br2($string) { $strTable.="PKWs".$row['pkw'].""; $strTable.="Fussgänger".$row['fuss'].""; $strTable.="Krafträder".$row['krad'].""; - $strTable.="LKWs".$row['lkw'].""; - $strTable.="Sonstiges".$row['sonstiges'].""; + $strTable.="LKWs".$row['lkw']."\n"; + $strTable.="Sonstiges".$row['sonstiges']."\n"; } /* @@ -143,13 +145,39 @@ function nl2br2($string) { WHERE IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstRad=0"; break; } - - + $result = $db->query($strSQL); if ($row = $result->fetchArray()) { - $strTable.="Alleinunfälle".$row['count'].""; + $strTable.="Alleinunfälle und Unfälle mit geicher Fahrzeugart".$row['count'].""; } - $strTable.=""; + + //Unfallart + + $strSQL="SELECT UART, count(UART) as anz FROM Unfallorte2019_Hamm WHERE ".$strWhere." GROUP BY UART"; + $strTable.="
Unfallart
"; + $strTable.=""; + $result = $db->query($strSQL); + while ($row = $result->fetchArray()) { + $strTable.="\n"; + } + $strTable.="
".$arrUnfallart[$row['UART']]."".$row['anz']."
"; + + //Unfallart + + $strSQL="SELECT UTYP1, count(UTYP1) as anz FROM Unfallorte2019_Hamm WHERE ".$strWhere." GROUP BY UTYP1"; + $strTable.="
Unfalltyp
"; + $strTable.=""; + $result = $db->query($strSQL); + while ($row = $result->fetchArray()) { + $strTable.="\n"; + } + $strTable.="
".$arrUnfalltyp[$row['UTYP1']]."".$row['anz']."
"; + + $strTable.="Unfalltpyen
"; + $strTable.="Unfallbeschreibung
"; + + + return $strTable; } \ No newline at end of file