site-accueil-insa/stats.php

79 lines
2 KiB
PHP
Raw Normal View History

2020-09-19 16:08:07 +02:00
<?php
ob_start(); // Start reading html
2022-06-14 21:46:39 +02:00
include "script/db.php";
2022-06-20 21:20:11 +02:00
$req_p0 = $db->query('SELECT SUM(points) AS s FROM scores WHERE team = 0');
$r0 = $req_p0->fetchAll(PDO::FETCH_ASSOC);
if(!($r0[0]['s'] > 0)) {
$r0[0]['s'] = 0;
}
$req_p1 = $db->query('SELECT SUM(points) AS s FROM scores WHERE team = 1');
$r1 = $req_p1->fetchAll(PDO::FETCH_ASSOC);
if(!($r1[0]['s'] > 0)) {
$r1[0]['s'] = 0;
}
2023-01-26 15:53:45 +01:00
include "assets/scripts/globals.php"
2020-09-19 16:08:07 +02:00
?>
2022-06-14 21:46:39 +02:00
<main>
2023-04-22 18:47:14 +02:00
<div class="zone_txt">
2022-06-14 21:46:39 +02:00
<strong>Les stats de la semaine.</strong>
<br><br>
Remporte le plus de points possible pour faire gagner ton équipe, mais attention à ne pas lui en faire
perdre !
<br><br>
<table class="out">
2022-06-14 21:50:30 +02:00
<tr>
2023-01-26 15:53:45 +01:00
<td><div class="title_in"><?=$TEAM1?> - <?= $r0[0]['s'] ?> points</div></td>
<td><div class="title_in"><?=$TEAM2?>- <?= $r1[0]['s'] ?> points</div></td>
2022-06-14 21:50:30 +02:00
</tr>
<tr>
<td>
<?php
$req = $db->query('SELECT texte, points FROM scores WHERE team = 0 ORDER BY id DESC');
while($r = $req->fetch()) {
?>
<span class="box-point">
<table class="in">
<td class="left"><?= $r['texte'] ?></td>
<td class="right"><?= $r['points'] ?></td>
</table>
</span>
<?php
}
?>
</td>
<td>
<?php
$req = $db->query('SELECT texte, points FROM scores WHERE team = 1 ORDER BY id DESC');
while($r = $req->fetch()) {
?>
<span class="box-point">
<table class="in">
<td class="left"><?= $r['texte'] ?></td>
<td class="right"><?= $r['points'] ?></td>
</table>
</span>
<?php
}
?>
2022-06-14 21:46:39 +02:00
2022-06-14 21:50:30 +02:00
</td>
</tr>
2022-06-14 21:46:39 +02:00
</table>
2023-04-22 18:47:14 +02:00
</div>
2022-06-14 21:46:39 +02:00
</main>
2020-09-19 16:08:07 +02:00
<?php
$infopage = ["", "Statistiques", ob_get_clean(), "", "stats","Stats de la semaine"]; //relativepath, pagetitle, pagecontent, pagescript | cf structure/template.php ligne 2 à 6
2022-01-19 22:26:58 +01:00
include("structure/template.php");
?>