Gemeinden detail
This commit is contained in:
parent
247294145f
commit
6a550d2fb8
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once("../config.php");
|
require_once("../config.php");
|
||||||
|
require_once("../lib/attributes.php");
|
||||||
|
require_once("include.php");
|
||||||
$numLand=5; // NRW
|
$numLand=5; // NRW
|
||||||
$numRegbez=(isset($_GET['regbez'])) ? (int)$_GET['regbez'] : 1;
|
$numRegbez=(isset($_GET['regbez'])) ? (int)$_GET['regbez'] : 1;
|
||||||
$numKreis=(isset($_GET['kreis'])) ? (int)$_GET['kreis'] : 1;
|
$numKreis=(isset($_GET['kreis'])) ? (int)$_GET['kreis'] : 1;
|
||||||
@ -19,6 +21,8 @@
|
|||||||
$numPopulation=$row['Einwohner'];
|
$numPopulation=$row['Einwohner'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$strLocation=" AND ULAND=$numLand AND UREGBEZ=$numRegbez AND UKREIS=$numKreis AND UGEMEINDE=$numGemeinde ";
|
||||||
|
|
||||||
//Unfallzahlen
|
//Unfallzahlen
|
||||||
|
|
||||||
$strWhat=" SUM(UKATEGORIE=1) as Tote,
|
$strWhat=" SUM(UKATEGORIE=1) as Tote,
|
||||||
@ -96,17 +100,56 @@
|
|||||||
|
|
||||||
<div class="container" style="margin-top:4em;">
|
<div class="container" style="margin-top:4em;">
|
||||||
<h1>Fahrradunfälle in <?=$strName?></h2>
|
<h1>Fahrradunfälle in <?=$strName?></h2>
|
||||||
|
Einwohnerzahl:<?=$numPopulation?> Fläche:<?=$numFlaeche?> km<sup>2</sup>
|
||||||
<h2>Unfallzahlen</h2>
|
<h2>Unfallzahlen</h2>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">
|
<div class="col-5">
|
||||||
<table class="table table-sm">
|
<table class="table table-sm">
|
||||||
<tr><th>Unfall mit Getöteten</th><td><?=$numTote?></td></tr>
|
<tr><th>Unfall mit Getöteten</th><td><?=$numTote?></td></tr>
|
||||||
<tr><th>Unfall mit Schwerverletztem</th><td><?=$numSchwerverletzte?></td></tr>
|
<tr><th>Unfall mit Schwerverletztem</th><td><?=$numSchwerverletzte?></td></tr>
|
||||||
<tr><th>Unfall mit Leichtverletztem</th><td><?=$numLeichtverletzte?></td></tr>
|
<tr><th>Unfall mit Leichtverletztem</th><td><?=$numLeichtverletzte?></td></tr>
|
||||||
<tr><th>Gesamt</th><td><strong><?=$numGesamt?></strong></td></tr>
|
<tr><th>Gesamt</th><td><strong><?=$numGesamt?></strong></td></tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</table>
|
<div class="row">
|
||||||
</div>
|
<div class="col-5">
|
||||||
</div>
|
<table class="table table-sm">
|
||||||
|
<tr><th>Quote pro Tausend Einwohner</th><td><?= round($numGesamt/$numPopulation*1000,2) ?></td></tr>
|
||||||
|
<tr><th>Quote pro Fläche</th><td><?= round($numGesamt/$numFlaeche,1) ?> /km<sup>2</sup></td></tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-5">
|
||||||
|
<h4>Unfallbeteiligte</h4>
|
||||||
|
<?php
|
||||||
|
echo get_beteiligte("",2022,$strLocation)
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-5">
|
||||||
|
<h4>Unfalltyp</h4>
|
||||||
|
<?php
|
||||||
|
echo get_unfalltyp("",2022,$strLocation);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-5">
|
||||||
|
<h4>Unfallart</h4>
|
||||||
|
<?php
|
||||||
|
echo get_unfallart("",2022,$strLocation);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</html>
|
</html>
|
65
statistics/include.php
Normal file
65
statistics/include.php
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function get_beteiligte($strWhere,$strYear,$strLocation) {
|
||||||
|
global $db;
|
||||||
|
$numVehicle=1;
|
||||||
|
$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 data
|
||||||
|
WHERE istRad=1 AND UJAHR =".$strYear.$strLocation;
|
||||||
|
$result = $db->query($strSQL);
|
||||||
|
|
||||||
|
$strTable="<table class='table table-sm'>";
|
||||||
|
if ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
$strTable.="<tr><td>Fahrräder</td><td>".$row['rad']."</td></tr>";
|
||||||
|
$strTable.="<tr><td>PKW</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>LKW</td><td>".$row['lkw']."</td></tr>\n";
|
||||||
|
$strTable.="<tr><td>Sonstiges</td><td>".$row['sonstiges']."</td></tr>\n";
|
||||||
|
}
|
||||||
|
$strSQL="SELECT count(*) as count FROM data
|
||||||
|
WHERE IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstSonstige=0".$strLocation;
|
||||||
|
|
||||||
|
$result = $db->query($strSQL." AND UJAHR=".$strYear);
|
||||||
|
if ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
$strTable.="<tr><td>Alleinunfälle und Unfälle mit geicher Fahrzeugart</td><td>".$row['count']."</td></tr>";
|
||||||
|
}
|
||||||
|
$strTable.="</table>";
|
||||||
|
return $strTable;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_unfalltyp($strWhere,$strYear,$strLocation){
|
||||||
|
global $db;
|
||||||
|
global $arrUnfalltyp;
|
||||||
|
$numVehicle=1;
|
||||||
|
$strSQL="SELECT UTYP1, count(UTYP1) as anz FROM data WHERE istRad=1 AND UJAHR=".$strYear.$strLocation." GROUP BY UTYP1";
|
||||||
|
$strTable="<table class='table table-sm'>";
|
||||||
|
$result = $db->query($strSQL);
|
||||||
|
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
$strTable.="<tr><td>".$arrUnfalltyp[$row['UTYP1']]."</td><td>".$row['anz']."</td></tr>\n";
|
||||||
|
}
|
||||||
|
$strTable.="</table>";
|
||||||
|
return $strTable;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_unfallart($strWhere,$strYear,$strLocation){
|
||||||
|
global $db;
|
||||||
|
global $arrUnfallart;
|
||||||
|
$numVehicle=1;
|
||||||
|
$strSQL="SELECT UART, count(UART) as anz FROM data WHERE istRad=1 AND UJAHR=".$strYear.$strLocation." GROUP BY UART";
|
||||||
|
$strTable="<table class='table table-sm'>";
|
||||||
|
$result = $db->query($strSQL);
|
||||||
|
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
$strTable.="<tr><td>".$arrUnfallart[$row['UART']]."</td><td>".$row['anz']."</td></tr>\n";
|
||||||
|
}
|
||||||
|
$strTable.="</table>";
|
||||||
|
return $strTable;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user