query('SELECT answer, point, team FROM enigma WHERE id = 1'); //id = 1 est la ligne correspondant à l'énigme de la plaquette $reponse = $req -> fetchAll(PDO::FETCH_ASSOC); if($reponse[0]['team'] == NULL) { //le "if" ici c'est parce que le 0 => $team = NULL du coup on doit genre faire une conversion relou if($team == "pkpeach") { $team = 0; } elseif($team == "boomario") { $team = 1; } else { header('Refresh: 0'); } if($ans == $reponse[0]['answer']) { $req = $db->prepare("INSERT INTO scores(texte, points, team, id_staff) VALUES(?, ?, ?, ?)"); $req->execute(array("enigme de la plaquette", $reponse[0]['point'], $team, 0)); $req = $db->prepare("UPDATE enigma SET team = ? WHERE id = 1"); $req->execute(array($team)); ?>
Enigme de la plaquette
query('SELECT team FROM enigma WHERE id = 1'); //id = 1 est la ligne correspondant à l'énigme de la plaquette $reponse = $req -> fetchAll(PDO::FETCH_ASSOC); //var_dump($reponse); if($reponse[0]['team'] == NULL) { ?>