query($strSQL); $arrResult = $result->fetchAll(PDO::FETCH_ASSOC); return $arrResult; } function get_beteiligte($numYear,$strLocation) { 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 FROM data WHERE istRad=1 AND UJAHR =".$numYear.$strLocation; $result = $db->query($strSQL); if ($row = $result->fetch(PDO::FETCH_ASSOC)) { $arrResult = $row; } $strSQL="SELECT count(*) as count FROM data WHERE UJAHR=".$numYear." AND IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstSonstige=0 ".$strLocation; $result = $db->query($strSQL); if ($row = $result->fetch(PDO::FETCH_ASSOC)) { $arrResult["gleich"]=$row['count']; } return $arrResult; } function get_unfalltyp($numYear,$strLocation){ global $db; $strSQL="SELECT UTYP1, count(UTYP1) as anz FROM data WHERE istRad=1 AND UJAHR=".$numYear.$strLocation." GROUP BY UTYP1"; $result = $db->query($strSQL); $arrResult = $result->fetchAll(PDO::FETCH_ASSOC); return $arrResult; } function get_unfallart($numYear,$strLocation){ global $db; $strSQL="SELECT UART, count(UART) as anz FROM data WHERE istRad=1 AND UJAHR=".$numYear.$strLocation." GROUP BY UART"; $result = $db->query($strSQL); $arrResult = $result->fetchAll(PDO::FETCH_ASSOC); return $arrResult; } function get_series($arrData,$arrBezeichnung,$strIndex1,$strIndex2="anz"){ $result="["; foreach ($arrData as $row) { $result.= "{ name: '".$arrBezeichnung[$row[$strIndex1]] ."', y: ".$row[$strIndex2]."},"; } $result.="]"; return $result; } function get_series_beteiligte($arrData,$arrBezeichnung){ $result="["; foreach ($arrData as $key => $numCount) { if ($key!="rad") { // Fahrräder sind immer beteiligt. $result .= "{name: '".$arrBezeichnung[$key]."', y: ".$numCount."},"; } } $result.="]"; return $result; } function get_verlauf($strLocation){ global $db; $strSQL="SELECT UJAHR, UKATEGORIE, count(UKATEGORIE) as anz FROM data WHERE IstRad=1 $strLocation GROUP BY UJAHR,UKATEGORIE ORDER BY UJAHR"; $result = $db->query($strSQL); $arrResult = array(); while ($row = $result->fetch(PDO::FETCH_ASSOC)){ $arrResult[$row['UJAHR']][$row['UKATEGORIE']]=$row['anz']; } return $arrResult; } function get_row($arrData,$kategorie){ global $numStartYear; global $numLatestYear; $strResult=""; if ($kategorie==0) { for ($i=$numLatestYear;$i>=$numStartYear;$i--){ $numAnzahl=0; for ($kat=0;$kat<=3;$kat++) { $numAnzahl+=(isset($arrData[$i][$kat])) ? $arrData[$i][$kat] : 0; } $strResult.="