-
-
Save anonymous/7e43bcaf9d4a3bbfaaad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $dsn = 'mysql:host=127.0.0.1:3306;dbname=mydb;charset=UTF8'; | |
| $username = 'root'; | |
| $password = '<dein passwort>'; | |
| $pdo = new PDO($dsn, $username, $password, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)); | |
| $stmt = $pdo->prepare('SELECT id, nickname, passwort, anrede, vorname, nachname, straße, plz, ort, telefon, email, geworben FROM nutzer ORDER BY :auswahl'); | |
| $stmt->execute(['auswahl' => $auswahl]); | |
| $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); | |
| ?> | |
| <p>Es wurden <?= count($rows) ?> Datensätze gefunden</p> | |
| <table border="2" rules="all"> | |
| <thead> | |
| <tr> | |
| <th width='200'>ID:</th> | |
| <th>Nickname:</th> | |
| <th>Passwort:</th> | |
| <th>Anrede:</th> | |
| <th>Vorname:</th> | |
| <th>Nachname:</th> | |
| <th>Straße:</th> | |
| <th>PLZ:</th> | |
| <th>Ort:</th> | |
| <th>Telefon:</th> | |
| <th>E-Mail:</th> | |
| <th>geworben:</th> | |
| <th> </th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <tr> | |
| <?php foreach($rows as $row): ?> | |
| <td><?= $row['nickname'] ?></td> | |
| <td><?= $row['passwort'] ?></td> | |
| <td><?= $row['anrede'] ?></td> | |
| <td><?= $row['vorname'] ?></td> | |
| <td><?= $row['nachname'] ?></td> | |
| <td><?= $row['straße'] ?></td> | |
| <td><?= $row['plz'] ?></td> | |
| <td><?= $row['ort'] ?></td> | |
| <td><?= $row['telefon'] ?></td> | |
| <td><?= $row['email'] ?></td> | |
| <td><?= $row['geworben'] ?></td> | |
| <td><a href="admin.php?seite=bearbeiten&id3=<?= $row['id'] ?>">Bearbeiten</a></td> | |
| <?php endforeach ?> | |
| </tr> | |
| </tbody> | |
| </table> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment