<?php

   $mydb= new DB_MySQL('zeltlager','zeltlager','Z3ltlager3363','localhost');

  $sql = "SELECT  a.*, p.gruppe, s.status_beitrag, s.status_spende, b.status_txt, c.spendenstatus_txt, d.prepaystatus_txt FROM 
AnmeldungAdressen AS a
LEFT JOIN AnmeldungPerson as p On p.uid = a.uid 
LEFT JOIN AnmeldungStatus AS s ON a.uid = s.uid
LEFT JOIN VerwaltungBeitragStatus AS b ON b.status = s.status_beitrag
LEFT JOIN VerwaltungBeitragStatus AS c ON c.status = s.status_spende
LEFT JOIN VerwaltungBeitragStatus AS d ON d.status = s.status_prepay
WHERE s.step = 11 AND s.bestaetigt = 1 ORDER BY a.nachname COLLATE latin1_german2_ci, a.vorname COLLATE latin1_german2_ci";
  $mydb->query($sql);

  $ResultCounter = $mydb->count() ; 
 
  echo "<div class=\"row\"><div class=\"col-lg-5\"><div class=\"alert alert-success text-center\">";
    echo "<b>Bestätigte Datensätze: $ResultCounter</b></div></div></div>";
  
  
  echo "<div class=\"panel panel-default\"><div class=\"panel-body\">";
  echo "<div class=\"table-responsive\">";
  echo "<table class=\"table table-striped table-bordered table-hover\" id=\"dataTables-show\">";
   
  echo "<thead><tr><th>UID</th><th>Nachname</th><th>Vorname</th><th>Straße</th><th>Ort</th><th>Jugendgruppe</th><th>Beitragsbuchung</th><th>Spendenbuchung</th><th>PrePay-buchung</th></tr></thead><tbody>";
  
  
  while ($row = $mydb->fetchRow())
  {  
    echo "<tr><td><font size=-1>" . $row['uid'] . "</font></td><td><font size=-1>" . $row['nachname'] . "</font></td><td><font size=-1>" . $row['vorname'] .  "</font></td> ";
    echo "<td><font size=-1>" . $row['strasse'] .  "</font></td> <td><font size=-1>" . $row['wohnort'] .  "</font></td>";
    echo "<td>". $row['gruppe'] ."</td>";
    echo "<td><font size=-1>" .  $row['status_txt'] .  "</font></td><td><font size=-1>" .  $row['spendenstatus_txt'] .  "</font></td><td><font size=-1>" .  $row['prepaystatus_txt'] .  "</font></td></tr>";       
  }
 
   echo "</tbody></table></div></div></div>\n";

  $mydb->disconnect();


?>
