Update games.php

This commit is contained in:
nolanwhy 2023-02-04 23:12:17 +01:00
parent 63970f0c38
commit fa8a312a33
1 changed files with 48 additions and 44 deletions

View File

@ -27,14 +27,25 @@ $getitstarted->header();
<div class="carousel-inner">
<div class="carousel-item active">
<div class="card-group" style=" margin-top: 15px; width: 100%;">
<?php $x = 8; for ($i = 1; $i <= $x; $i++) { ?>
<?php
$sql = "SELECT allStar FROM games";
$q = $con->prepare(str_replace('allStar', 'count(*)', $sql));
$q->execute();
$numberOfGames = $q->fetchColumn();
$q = $con->prepare(str_replace('allStar', '*', $sql));
$q->execute();
if ($numberOfGames >= 1) {
while ($game = $q->fetch()) {
$playingCount = 69;
$x = 8;
for ($i = 1; $i <= $x; $i++) { ?>
<div class="card bg-dark border-start rounded shadow-sm" style="max-width: 170px; margin-right: 9px;">
<a href="game?id=1" style="text-decoration: none; text-align: left; margin-bottom: 9px;">
<img src="https://tr.rbxcdn.com/4e0bd5c77756dce55561929587ff8772/150/150/Image/Png" class="card-img-top rounded-top" alt="...">
<a href="game?id=<?php echo (int)htmlspecialchars($game["id"]); ?>" style="text-decoration: none; text-align: left; margin-bottom: 9px;">
<img src="<?php echo htmlspecialchars($game["thumbnail"]); ?>" class="card-img-top rounded-top" alt="<?php echo htmlspecialchars($game["name"]); ?>">
<div class="card-body">
<small class="card-title text-white" style="font-size: 1rem;">Build to survive ur mom</small>
<small class="card-title text-white" style="font-size: 1rem;"><?php echo htmlspecialchars($game["name"]); ?></small>
<br>
<small class="card-text text-muted">69 playing</small>
<small class="card-text text-muted"><?php echo (int)$playingCount; ?> playing</small>
<div class="progress rounded-4 border border-secondary" style="margin-left: 20px; margin-top: 10px; margin-bottom: -10px; height: 8px; background: none;">
<div class="progress-bar bg-secondary" role="progressbar" aria-label="Segment one" style="width: 21.5%" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100"></div>
</div>
@ -42,26 +53,17 @@ $getitstarted->header();
</div>
</a>
</div>
<?php if ($i == $x) { break; } }?>
<?php
if ($i == $x) {
break;
}
}
}
} else {
echo "no games";} ?>
</div>
</div>
<div class="carousel-item"><div class="card-group" style=" margin-top: 15px; width: 100%;">
<?php $x = 8; for ($i = 1; $i <= $x; $i++) { ?>
<div class="card bg-dark border-start rounded shadow-sm" style="max-width: 170px; margin-right: 9px;">
<a href="game?id=1" style="text-decoration: none; text-align: left; margin-bottom: 9px;">
<img src="https://tr.rbxcdn.com/4e0bd5c77756dce55561929587ff8772/150/150/Image/Png" class="card-img-top rounded-top" alt="...">
<div class="card-body">
<small class="card-title text-white" style="font-size: 1rem;">Build to survive ur mom</small>
<br>
<small class="card-text text-muted">69 playing</small>
<div class="progress rounded-4 border border-secondary" style="margin-left: 20px; margin-top: 10px; margin-bottom: -10px; height: 8px; background: none;">
<div class="progress-bar bg-secondary" role="progressbar" aria-label="Segment one" style="width: 21.5%" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<i class="bi bi-hand-thumbs-up-fill text-secondary" style="font-size: 1rem; float: left; margin-top: -8px;"></i>
</div>
</a>
</div>
<?php if ($i == $x) { break; } }?>
</div></div>
<div class="carousel-item"></div>
</div>
@ -79,14 +81,25 @@ $getitstarted->header();
<div class="carousel-inner">
<div class="carousel-item active">
<div class="card-group" style=" margin-top: 15px; width: 100%;">
<?php $x = 8; for ($i = 1; $i <= $x; $i++) { ?>
<?php
$sql = "SELECT allStar FROM games";
$q = $con->prepare(str_replace('allStar', 'count(*)', $sql));
$q->execute();
$numberOfGames = $q->fetchColumn();
$q = $con->prepare(str_replace('allStar', '*', $sql));
$q->execute();
if ($numberOfGames >= 1) {
while ($game = $q->fetch()) {
$playingCount = 69;
$x = 8;
for ($i = 1; $i <= $x; $i++) { ?>
<div class="card bg-dark border-start rounded shadow-sm" style="max-width: 170px; margin-right: 9px;">
<a href="game?id=1" style="text-decoration: none; text-align: left; margin-bottom: 9px;">
<img src="https://tr.rbxcdn.com/4e0bd5c77756dce55561929587ff8772/150/150/Image/Png" class="card-img-top rounded-top" alt="...">
<a href="game?id=<?php echo (int)htmlspecialchars($game["id"]); ?>" style="text-decoration: none; text-align: left; margin-bottom: 9px;">
<img src="<?php echo htmlspecialchars($game["thumbnail"]); ?>" class="card-img-top rounded-top" alt="<?php echo htmlspecialchars($game["name"]); ?>">
<div class="card-body">
<small class="card-title text-white" style="font-size: 1rem;">Build to survive ur mom</small>
<small class="card-title text-white" style="font-size: 1rem;"><?php echo htmlspecialchars($game["name"]); ?></small>
<br>
<small class="card-text text-muted">69 playing</small>
<small class="card-text text-muted"><?php echo (int)$playingCount; ?> playing</small>
<div class="progress rounded-4 border border-secondary" style="margin-left: 20px; margin-top: 10px; margin-bottom: -10px; height: 8px; background: none;">
<div class="progress-bar bg-secondary" role="progressbar" aria-label="Segment one" style="width: 21.5%" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100"></div>
</div>
@ -94,26 +107,17 @@ $getitstarted->header();
</div>
</a>
</div>
<?php if ($i == $x) { break; } }?>
<?php
if ($i == $x) {
break;
}
}
}
} else {
echo "no games";} ?>
</div>
</div>
<div class="carousel-item"><div class="card-group" style=" margin-top: 15px; width: 100%;">
<?php $x = 8; for ($i = 1; $i <= $x; $i++) { ?>
<div class="card bg-dark border-start rounded shadow-sm" style="max-width: 170px; margin-right: 9px;">
<a href="game?id=1" style="text-decoration: none; text-align: left; margin-bottom: 9px;">
<img src="https://tr.rbxcdn.com/4e0bd5c77756dce55561929587ff8772/150/150/Image/Png" class="card-img-top rounded-top" alt="...">
<div class="card-body">
<small class="card-title text-white" style="font-size: 1rem;">Build to survive ur mom</small>
<br>
<small class="card-text text-muted">69 playing</small>
<div class="progress rounded-4 border border-secondary" style="margin-left: 20px; margin-top: 10px; margin-bottom: -10px; height: 8px; background: none;">
<div class="progress-bar bg-secondary" role="progressbar" aria-label="Segment one" style="width: 21.5%" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<i class="bi bi-hand-thumbs-up-fill text-secondary" style="font-size: 1rem; float: left; margin-top: -8px;"></i>
</div>
</a>
</div>
<?php if ($i == $x) { break; } }?>
</div></div>
<div class="carousel-item"></div>
</div>