gespielte_spiele.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. include 'db_config.php'; // Falls du die Connection auslagerst, sonst Code von oben kopieren
  3. $sql = "SELECT DISTINCT sp.* FROM spiele sp
  4. JOIN scores sc ON sp.id = sc.spiel_id
  5. ORDER BY sp.titel ASC";
  6. $stmt = $pdo->query($sql);
  7. $playedGames = $stmt->fetchAll();
  8. ?>
  9. <!DOCTYPE html>
  10. <html lang="de">
  11. <head>
  12. <meta charset="UTF-8">
  13. <title>Gespielte Spiele</title>
  14. <style>
  15. body { font-family: sans-serif; background: #121212; color: white; padding: 20px; }
  16. .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
  17. .item { background: #1e1e1e; padding: 10px; border-radius: 8px; text-align: center; border: 1px solid #333; }
  18. .item img { width: 100%; border-radius: 4px; height: 150px; object-fit: cover; }
  19. h1 { color: #e67e22; }
  20. .back { display: inline-block; margin-bottom: 20px; color: #e67e22; text-decoration: none; }
  21. </style>
  22. </head>
  23. <body>
  24. <a href="index.php" class="back">← Zurück zum Dashboard</a>
  25. <h1>📂 Gelöste Abenteuer</h1>
  26. <div class="grid">
  27. <?php foreach ($playedGames as $game): ?>
  28. <div class="item">
  29. <img src="<?= htmlspecialchars($game['bild_url']) ?>">
  30. <p><?= htmlspecialchars($game['titel']) ?></p>
  31. </div>
  32. <?php endforeach; ?>
  33. </div>
  34. </body>
  35. </html>