statistic
This commit is contained in:
parent
47ae3e17ee
commit
c0124a05b6
@ -60,7 +60,6 @@
|
||||
|
||||
$strDescription=generate_tooltip_description($row);
|
||||
|
||||
|
||||
$arrMarker[]="marker[".$id."] = [L.marker([".$numLat."," .$numLng."],"
|
||||
." { icon: ".$arrMarkerType[$topic]." }),'check_".$topic."'];\n"
|
||||
."marker[".$id."][0].addTo(mymap);\n "
|
||||
@ -134,12 +133,12 @@
|
||||
|
||||
<nav class="col-md-2 d-none d-md-block bg-light sidebar">
|
||||
<div class="sidebar-sticky">
|
||||
|
||||
<h2>Unfälle mit <?= $arrVehicles_pl[$numVehicle]; ?> </h2>
|
||||
<ul class="nav flex-column">
|
||||
Unfälle mit
|
||||
<?php
|
||||
echo $arrVehicles_pl[$numVehicle];
|
||||
?>
|
||||
<?php echo get_statistics($numVehicle,$strWhere); ?>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
@ -82,4 +82,74 @@ function read_gps_location($file){
|
||||
function nl2br2($string) {
|
||||
$string = str_replace(array("\r\n", "\r", "\n"), "<br />", $string);
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function get_statistics($numVehicle,$strWhere) {
|
||||
global $db;
|
||||
$strSQL="SELECT
|
||||
sum(IstRad) as rad,
|
||||
sum(IstPKW) as pkw,
|
||||
sum(IstFuss) as fuss,
|
||||
sum(IstKrad) as krad,
|
||||
sum(IstGkfz) as lkw,
|
||||
sum(IstSonstige) as sonstiges,
|
||||
count(*) as summe
|
||||
FROM Unfallorte2019_Hamm
|
||||
WHERE ".$strWhere;
|
||||
|
||||
$result = $db->query($strSQL);
|
||||
|
||||
$strTable="<table class='statistik'>";
|
||||
$strTable.="<tr><th>Unfallbeteiligte</th><th>Anzahl</th></tr>";
|
||||
while ($row = $result->fetchArray()) {
|
||||
$strTable.="<tr><td>Fahrräder</td><td>".$row['rad']."</td></tr>";
|
||||
$strTable.="<tr><td>PKWs</td><td>".$row['pkw']."</td></tr>";
|
||||
$strTable.="<tr><td>Fussgänger</td><td>".$row['fuss']."</td></tr>";
|
||||
$strTable.="<tr><td>Krafträder</td><td>".$row['krad']."</td></tr>";
|
||||
$strTable.="<tr><td>LKWs</td><td>".$row['lkw']."</td></tr>";
|
||||
$strTable.="<tr><td>Sonstiges</td><td>".$row['sonstiges']."</td></tr>";
|
||||
|
||||
}
|
||||
/*
|
||||
$strSQL="SELECT count(*) as count
|
||||
FROM Unfallorte2019_Hamm
|
||||
WHERE IstRad=0 and IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstSonstige=0";
|
||||
*/
|
||||
switch ($numVehicle) {
|
||||
case 1:
|
||||
case 0:
|
||||
$strSQL="SELECT count(*) as count FROM Unfallorte2019_Hamm
|
||||
WHERE IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstSonstige=0";
|
||||
break;
|
||||
case 2:
|
||||
$strSQL="SELECT count(*) as count FROM Unfallorte2019_Hamm
|
||||
WHERE IstRad=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstSonstige=0";
|
||||
break;
|
||||
case 3:
|
||||
$strSQL="SELECT count(*) as count FROM Unfallorte2019_Hamm
|
||||
WHERE IstPKW=0 and IstRad=0 and IstKrad and IstGkfz=0 and IstSonstige=0";
|
||||
break;
|
||||
case 4:
|
||||
$strSQL="SELECT count(*) as count FROM Unfallorte2019_Hamm
|
||||
WHERE IstPKW=0 and IstFuss=0 and IstRad=0 and IstGkfz=0 and IstSonstige=0";
|
||||
break;
|
||||
case 5:
|
||||
$strSQL="SELECT count(*) as count FROM Unfallorte2019_Hamm
|
||||
WHERE IstPKW=0 and IstFuss=0 and IstKrad=0 and IstRad=0 and IstSonstige=0";
|
||||
break;
|
||||
case 6:
|
||||
$strSQL="SELECT count(*) as count FROM Unfallorte2019_Hamm
|
||||
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.="<tr><td>Alleinunfälle</td><td>".$row['count']."</td></tr>";
|
||||
}
|
||||
|
||||
$strTable.="</table>";
|
||||
return $strTable;
|
||||
}
|
Loading…
Reference in New Issue
Block a user