Gemeinde Detail
This commit is contained in:
parent
d841823661
commit
247294145f
112
statistics/gemeinde_detail.php
Normal file
112
statistics/gemeinde_detail.php
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
<?php
|
||||||
|
require_once("../config.php");
|
||||||
|
$numLand=5; // NRW
|
||||||
|
$numRegbez=(isset($_GET['regbez'])) ? (int)$_GET['regbez'] : 1;
|
||||||
|
$numKreis=(isset($_GET['kreis'])) ? (int)$_GET['kreis'] : 1;
|
||||||
|
$numGemeinde=(isset($_GET['gemeinde'])) ? (int)$_GET['gemeinde'] : 1;
|
||||||
|
$numJahr=2022;
|
||||||
|
|
||||||
|
// Name, Population und Fläche der Gemeinde
|
||||||
|
$result= $db->prepare("SELECT * FROM community WHERE ULAND=:land AND UREGBEZ=:regbez AND UKREIS=:kreis AND UGEMEINDE=:gemeinde");
|
||||||
|
$result->bindParam(":land",$numLand);
|
||||||
|
$result->bindParam(":regbez",$numRegbez);
|
||||||
|
$result->bindParam(":kreis",$numKreis);
|
||||||
|
$result->bindParam(":gemeinde",$numGemeinde);
|
||||||
|
$result->execute();
|
||||||
|
if ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
$strName=$row['Name'];
|
||||||
|
$numFlaeche=$row['Flaeche'];
|
||||||
|
$numPopulation=$row['Einwohner'];
|
||||||
|
}
|
||||||
|
|
||||||
|
//Unfallzahlen
|
||||||
|
|
||||||
|
$strWhat=" SUM(UKATEGORIE=1) as Tote,
|
||||||
|
SUM(UKATEGORIE=2) as Schwerverletzte,
|
||||||
|
SUM(UKATEGORIE=3) as Leichtverletzte,
|
||||||
|
COUNT(*) as gesamt";
|
||||||
|
$strWhere= " IstRad=1 ";
|
||||||
|
$strSQL="SELECT $strWhat FROM data
|
||||||
|
WHERE $strWhere
|
||||||
|
AND ULAND=:land AND UREGBEZ=:regbez AND UKREIS=:kreis
|
||||||
|
AND UGEMEINDE=:gemeinde AND UJAHR=:jahr";
|
||||||
|
|
||||||
|
$result= $db->prepare($strSQL);
|
||||||
|
$result->bindParam(":land",$numLand);
|
||||||
|
$result->bindParam(":regbez",$numRegbez);
|
||||||
|
$result->bindParam(":kreis",$numKreis);
|
||||||
|
$result->bindParam(":gemeinde",$numGemeinde);
|
||||||
|
$result->bindParam(":jahr",$numJahr);
|
||||||
|
$result->execute();
|
||||||
|
if ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
$numTote=$row['Tote'];
|
||||||
|
$numSchwerverletzte=$row['Schwerverletzte'];
|
||||||
|
$numLeichtverletzte=$row['Leichtverletzte'];
|
||||||
|
$numGesamt=$row['gesamt'];
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>Fahrrad-Unfallstatistik NRW</title>
|
||||||
|
<link rel="stylesheet" href="../css/bootstrap.min.css"/>
|
||||||
|
<link rel="stylesheet" href="//cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css">
|
||||||
|
|
||||||
|
<script src="../js/jquery.min.js"></script>
|
||||||
|
<script src="//cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
|
||||||
|
<style>
|
||||||
|
.rechts {text-align:right;background-color:#eee;}
|
||||||
|
.l {border-left: 1px solid black; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<!-- Navbar -->
|
||||||
|
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||||
|
<a class="navbar-brand" href="#">Unfallkarte</a>
|
||||||
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbars" aria-controls="navbars" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbars">
|
||||||
|
<ul class="navbar-nav mr-auto">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="../index.php">Karte</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<ul class="navbar-nav mr-auto right">
|
||||||
|
<li class="nav-item active">
|
||||||
|
<a class="nav-link" href="index.php">Statistik <span class="sr-only">(current)</span></a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="../impressum.php">Impressum</span></a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="../datenschutz.php">Datenschutzerklärung</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
<!-- Ende Navbar -->
|
||||||
|
|
||||||
|
|
||||||
|
<div class="container" style="margin-top:4em;">
|
||||||
|
<h1>Fahrradunfälle in <?=$strName?></h2>
|
||||||
|
<h2>Unfallzahlen</h2>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">
|
||||||
|
<table class="table table-sm">
|
||||||
|
<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 Leichtverletztem</th><td><?=$numLeichtverletzte?></td></tr>
|
||||||
|
<tr><th>Gesamt</th><td><strong><?=$numGesamt?></strong></td></tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</html>
|
@ -16,6 +16,7 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<!-- Navbar -->
|
<!-- Navbar -->
|
||||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||||
<a class="navbar-brand" href="#">Unfallkarte</a>
|
<a class="navbar-brand" href="#">Unfallkarte</a>
|
||||||
@ -46,8 +47,8 @@
|
|||||||
<!-- Ende Navbar -->
|
<!-- Ende Navbar -->
|
||||||
|
|
||||||
|
|
||||||
<div class="container-fluid">
|
<div class="container-fluid" style="margin-top:4em;">
|
||||||
<h1>Fahrradunfälle in Nordrhein-Westfalen in Gemeinden</h2>
|
<h1>Fahrradunfälle in Nordrhein-Westfalen in Gemeinden</h2>
|
||||||
<table id="unfallzahlen" class="display">
|
<table id="unfallzahlen" class="display">
|
||||||
<thead>
|
<thead>
|
||||||
<tr><th></th>
|
<tr><th></th>
|
||||||
@ -74,27 +75,31 @@
|
|||||||
require("../config.php");
|
require("../config.php");
|
||||||
|
|
||||||
$strSQL="SELECT d.Name as Gemeinde,
|
$strSQL="SELECT d.Name as Gemeinde,
|
||||||
SUM(UJAHR=2022) as Jahr_2022,
|
SUM(UJAHR=2022) as Jahr_2022,
|
||||||
SUM(UJAHR=2021) as Jahr_2021,
|
SUM(UJAHR=2021) as Jahr_2021,
|
||||||
SUM(UJAHR=2020) as Jahr_2020,
|
SUM(UJAHR=2020) as Jahr_2020,
|
||||||
SUM(UJAHR=2019) as Jahr_2019,
|
SUM(UJAHR=2019) as Jahr_2019,
|
||||||
|
|
||||||
SUM(UJAHR=2022 AND UKATEGORIE=1) as Tode_2022,
|
SUM(UJAHR=2022 AND UKATEGORIE=1) as Tode_2022,
|
||||||
SUM(UJAHR=2021 AND UKATEGORIE=1) as Tode_2021,
|
SUM(UJAHR=2021 AND UKATEGORIE=1) as Tode_2021,
|
||||||
SUM(UJAHR=2020 AND UKATEGORIE=1) as Tode_2020,
|
SUM(UJAHR=2020 AND UKATEGORIE=1) as Tode_2020,
|
||||||
SUM(UJAHR=2019 AND UKATEGORIE=1) as Tode_2019,
|
SUM(UJAHR=2019 AND UKATEGORIE=1) as Tode_2019,
|
||||||
|
|
||||||
SUM(UJAHR=2022 AND UKATEGORIE=2) as Schwerverletzt_2022,
|
SUM(UJAHR=2022 AND UKATEGORIE=2) as Schwerverletzt_2022,
|
||||||
SUM(UJAHR=2021 AND UKATEGORIE=2) as Schwerverletzt_2021,
|
SUM(UJAHR=2021 AND UKATEGORIE=2) as Schwerverletzt_2021,
|
||||||
SUM(UJAHR=2020 AND UKATEGORIE=2) as Schwerverletzt_2020,
|
SUM(UJAHR=2020 AND UKATEGORIE=2) as Schwerverletzt_2020,
|
||||||
SUM(UJAHR=2019 AND UKATEGORIE=2) as Schwerverletzt_2019,
|
SUM(UJAHR=2019 AND UKATEGORIE=2) as Schwerverletzt_2019,
|
||||||
|
|
||||||
SUM(UJAHR=2022 AND UKATEGORIE=3) as Leichtverletzt_2022,
|
SUM(UJAHR=2022 AND UKATEGORIE=3) as Leichtverletzt_2022,
|
||||||
SUM(UJAHR=2021 AND UKATEGORIE=3) as Leichtverletzt_2021,
|
SUM(UJAHR=2021 AND UKATEGORIE=3) as Leichtverletzt_2021,
|
||||||
SUM(UJAHR=2020 AND UKATEGORIE=3) as Leichtverletzt_2020,
|
SUM(UJAHR=2020 AND UKATEGORIE=3) as Leichtverletzt_2020,
|
||||||
SUM(UJAHR=2019 AND UKATEGORIE=3) as Leichtverletzt_2019,
|
SUM(UJAHR=2019 AND UKATEGORIE=3) as Leichtverletzt_2019,
|
||||||
Flaeche, Einwohner,
|
Flaeche, Einwohner,
|
||||||
SUM(UJAHR=2022)/d.Einwohner*1000 as Quote_2022
|
SUM(UJAHR=2022)/d.Einwohner*1000 as Quote_2022,
|
||||||
|
d.ULAND,
|
||||||
|
d.UREGBEZ,
|
||||||
|
d.UKREIS,
|
||||||
|
d.UGEMEINDE
|
||||||
FROM data s, community d
|
FROM data s, community d
|
||||||
WHERE IstRad=1
|
WHERE IstRad=1
|
||||||
AND d.ULAND=s.ULAND AND d.UREGBEZ=s.UREGBEZ AND d.UKREIS=s.UKREIS AND d.UGEMEINDE=s.UGEMEINDE
|
AND d.ULAND=s.ULAND AND d.UREGBEZ=s.UREGBEZ AND d.UKREIS=s.UKREIS AND d.UGEMEINDE=s.UGEMEINDE
|
||||||
@ -107,7 +112,7 @@ $result=$db->query($strSQL);
|
|||||||
|
|
||||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
echo "<td>".$row['Gemeinde']."</td>";
|
echo "<td><a href='gemeinde_detail.php?regbez=".$row['UREGBEZ']."&kreis=".$row['UKREIS']."&gemeinde=".$row['UGEMEINDE']."'>".$row['Gemeinde']."</a></td>";
|
||||||
echo "<td class='l'>".$row['Jahr_2022']."</td>";
|
echo "<td class='l'>".$row['Jahr_2022']."</td>";
|
||||||
echo "<td>".$row['Jahr_2021']."</td>";
|
echo "<td>".$row['Jahr_2021']."</td>";
|
||||||
echo "<td>".$row['Jahr_2020']."</td>";
|
echo "<td>".$row['Jahr_2020']."</td>";
|
||||||
@ -136,6 +141,8 @@ while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
|||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
<script>
|
<script>
|
||||||
let table = new DataTable('#unfallzahlen');
|
let table = new DataTable('#unfallzahlen',{
|
||||||
|
pageLength : 50
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</html>
|
</html>
|
||||||
|
0
statistics/kreis_detail.php
Normal file
0
statistics/kreis_detail.php
Normal file
@ -47,7 +47,7 @@
|
|||||||
<!-- Ende Navbar -->
|
<!-- Ende Navbar -->
|
||||||
|
|
||||||
|
|
||||||
<div class="container-fluid">
|
<div class="container-fluid" style="margin-top:4em;">
|
||||||
<h1>Fahrradunfälle in Nordrhein-Westfalen in Kreisen und kreisfreien Städten</h2>
|
<h1>Fahrradunfälle in Nordrhein-Westfalen in Kreisen und kreisfreien Städten</h2>
|
||||||
<table id="unfallzahlen" class="display">
|
<table id="unfallzahlen" class="display">
|
||||||
<thead>
|
<thead>
|
||||||
@ -132,7 +132,9 @@ while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
let table = new DataTable('#unfallzahlen');
|
let table = new DataTable('#unfallzahlen',{
|
||||||
|
pageLength : 25
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
Loading…
Reference in New Issue
Block a user