mysql
This commit is contained in:
		@@ -88,13 +88,14 @@ function nl2br2($string) {
 | 
			
		||||
    global $arrUnfallart;
 | 
			
		||||
    global $arrUnfalltyp;
 | 
			
		||||
    global $arrCategory;
 | 
			
		||||
    global $strLocation;
 | 
			
		||||
 | 
			
		||||
    $strTable="<h5>Unfallkategorie</h5>";
 | 
			
		||||
    $strTable.="<table class='statistik'>";
 | 
			
		||||
    $strSQL="SELECT UKATEGORIE, count(UKATEGORIE) as anz FROM Unfallorte_Hamm WHERE ".$strWhere.$strYear." GROUP BY UKATEGORIE";
 | 
			
		||||
    $strSQL="SELECT UKATEGORIE, count(UKATEGORIE) as anz FROM data WHERE ".$strWhere.$strYear.$strLocation." GROUP BY UKATEGORIE";
 | 
			
		||||
    $result = $db->query($strSQL);
 | 
			
		||||
   
 | 
			
		||||
    while ($row = $result->fetchArray()) {
 | 
			
		||||
    while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
 | 
			
		||||
        $strTable.="<tr><td>".$arrCategory[$row['UKATEGORIE']]."</td><td>".$row['anz']."</td></tr>\n";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -109,14 +110,14 @@ function nl2br2($string) {
 | 
			
		||||
                  sum(IstGkfz) as lkw,
 | 
			
		||||
                  sum(IstSonstige) as sonstiges,
 | 
			
		||||
                  count(*) as summe
 | 
			
		||||
             FROM Unfallorte_Hamm 
 | 
			
		||||
             WHERE ".$strWhere.$strYear;
 | 
			
		||||
             FROM data 
 | 
			
		||||
             WHERE ".$strWhere.$strYear.$strLocation;
 | 
			
		||||
        
 | 
			
		||||
    $result = $db->query($strSQL);
 | 
			
		||||
    $strTable.="<h5>Unfallbeteiligte</h5>";
 | 
			
		||||
    $strTable.="<table class='statistik'>";
 | 
			
		||||
    //$strTable.="<tr><th>Unfallbeteiligte</th><th>Anzahl</th></tr>";
 | 
			
		||||
    while ($row = $result->fetchArray()) {
 | 
			
		||||
    while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
 | 
			
		||||
       $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>";
 | 
			
		||||
@@ -127,61 +128,61 @@ function nl2br2($string) {
 | 
			
		||||
    }
 | 
			
		||||
    /*
 | 
			
		||||
    $strSQL="SELECT count(*) as count
 | 
			
		||||
                FROM Unfallorte_Hamm 
 | 
			
		||||
                FROM data 
 | 
			
		||||
                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 Unfallorte_Hamm  
 | 
			
		||||
                        WHERE  IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstSonstige=0"; 
 | 
			
		||||
                $strSQL="SELECT count(*) as count FROM data  
 | 
			
		||||
                        WHERE  IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstSonstige=0".$strLocation; 
 | 
			
		||||
                break;
 | 
			
		||||
        case 2: 
 | 
			
		||||
            $strSQL="SELECT count(*) as count FROM Unfallorte_Hamm  
 | 
			
		||||
                    WHERE  IstRad=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstSonstige=0"; 
 | 
			
		||||
            $strSQL="SELECT count(*) as count FROM data  
 | 
			
		||||
                    WHERE  IstRad=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstSonstige=0".$strLocation; 
 | 
			
		||||
            break;
 | 
			
		||||
        case 3: 
 | 
			
		||||
            $strSQL="SELECT count(*) as count FROM Unfallorte_Hamm  
 | 
			
		||||
                    WHERE  IstPKW=0 and IstRad=0 and IstKrad and IstGkfz=0 and IstSonstige=0"; 
 | 
			
		||||
            $strSQL="SELECT count(*) as count FROM data  
 | 
			
		||||
                    WHERE  IstPKW=0 and IstRad=0 and IstKrad and IstGkfz=0 and IstSonstige=0".$strLocation; 
 | 
			
		||||
            break;
 | 
			
		||||
        case 4: 
 | 
			
		||||
            $strSQL="SELECT count(*) as count FROM Unfallorte_Hamm  
 | 
			
		||||
                    WHERE  IstPKW=0 and IstFuss=0 and IstRad=0 and IstGkfz=0 and IstSonstige=0"; 
 | 
			
		||||
            $strSQL="SELECT count(*) as count FROM data  
 | 
			
		||||
                    WHERE  IstPKW=0 and IstFuss=0 and IstRad=0 and IstGkfz=0 and IstSonstige=0".$strLocation; 
 | 
			
		||||
            break;
 | 
			
		||||
        case 5: 
 | 
			
		||||
            $strSQL="SELECT count(*) as count FROM Unfallorte_Hamm  
 | 
			
		||||
                    WHERE  IstPKW=0 and IstFuss=0 and IstKrad=0 and IstRad=0 and IstSonstige=0"; 
 | 
			
		||||
            $strSQL="SELECT count(*) as count FROM data  
 | 
			
		||||
                    WHERE  IstPKW=0 and IstFuss=0 and IstKrad=0 and IstRad=0 and IstSonstige=0".$strLocation; 
 | 
			
		||||
            break;
 | 
			
		||||
        case 6: 
 | 
			
		||||
            $strSQL="SELECT count(*) as count FROM Unfallorte_Hamm  
 | 
			
		||||
                    WHERE  IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstRad=0"; 
 | 
			
		||||
            $strSQL="SELECT count(*) as count FROM data  
 | 
			
		||||
                    WHERE  IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstRad=0".$strLocation; 
 | 
			
		||||
            break;
 | 
			
		||||
        }                                                                       
 | 
			
		||||
                      
 | 
			
		||||
    $result = $db->query($strSQL.$strYear);
 | 
			
		||||
    if ($row = $result->fetchArray()) {
 | 
			
		||||
    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>";
 | 
			
		||||
 | 
			
		||||
    //Unfallart
 | 
			
		||||
 | 
			
		||||
    $strSQL="SELECT UART, count(UART) as anz FROM Unfallorte_Hamm WHERE ".$strWhere.$strYear." GROUP BY UART";
 | 
			
		||||
    $strSQL="SELECT UART, count(UART) as anz FROM data WHERE ".$strWhere.$strYear.$strLocation." GROUP BY UART";
 | 
			
		||||
    $strTable.="<h5>Unfallart</h5>";
 | 
			
		||||
    $strTable.="<table class='statistik'>";
 | 
			
		||||
    $result = $db->query($strSQL);
 | 
			
		||||
    while ($row = $result->fetchArray()) {
 | 
			
		||||
    while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
 | 
			
		||||
        $strTable.="<tr><td>".$arrUnfallart[$row['UART']]."</td><td>".$row['anz']."</td></tr>\n";
 | 
			
		||||
    }
 | 
			
		||||
    $strTable.="</table>";
 | 
			
		||||
 | 
			
		||||
    //Unfallart
 | 
			
		||||
 | 
			
		||||
    $strSQL="SELECT UTYP1, count(UTYP1) as anz FROM Unfallorte_Hamm WHERE ".$strWhere.$strYear." GROUP BY UTYP1";
 | 
			
		||||
    $strSQL="SELECT UTYP1, count(UTYP1) as anz FROM data WHERE ".$strWhere.$strYear.$strLocation." GROUP BY UTYP1";
 | 
			
		||||
    $strTable.="<h5>Unfalltyp</h5>";
 | 
			
		||||
    $strTable.="<table class='statistik'>";
 | 
			
		||||
    $result = $db->query($strSQL);
 | 
			
		||||
    while ($row = $result->fetchArray()) {
 | 
			
		||||
    while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
 | 
			
		||||
        $strTable.="<tr><td>".$arrUnfalltyp[$row['UTYP1']]."</td><td>".$row['anz']."</td></tr>\n";
 | 
			
		||||
    }
 | 
			
		||||
    $strTable.="</table>";
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user