Fin implémentation ordre des énigmes.

This commit is contained in:
antux18 2024-02-16 10:55:10 +01:00
parent a0e3ba8c09
commit 559d42fff1
2 changed files with 5 additions and 5 deletions

Binary file not shown.

View File

@ -41,12 +41,12 @@
$stmt = $database->pdo_teams->prepare("SELECT pzorder FROM teams WHERE id == :id");
$stmt->bindValue(":id", $team_id);
$stmt->execute();
$order = $stmt->fetch();
echo (string) $order["pzorder"];
$result = $stmt->fetch();
$order = $result["pzorder"];
// Si un ordre d'énigmes n'a pas été défini au préalable pour cette équipe, on en choisit un au hasard :
if ($order == NULL) {
if (is_null($order)) {
echo "lol";
$order = rand(0, sizeof($pzorder));
$stmt = $database->pdo_teams->prepare("UPDATE teams SET pzorder = :order WHERE id == :id");
$stmt->bindValue(":id", $team_id);
@ -83,7 +83,7 @@
<article>
<p><?= $tr["puzzles"]["message"]?></p>
<ul>
<?php foreach ($pzorder[$order["pzorder"]] as $pzid) : ?>
<?php foreach ($pzorder[$order] as $pzid) : ?>
<?php foreach ($puzzles as $puzzle) : ?>
<?php if ($puzzle["id"] == $pzid) : ?>
<li><a href="article.php?team=<?= $team_id ?>&id=<?= $puzzle["id"] ?>"><?= $tr["page_title"]["article"] . $puzzle["id"] . " : " . $puzzle["title"] ?></a></li>