query($query); $votationLine = $db->result->fetch_assoc(); return $votationLine["libelle"]; } function queryVotes($db, $idVotation) { $query = "SELECT * FROM liste_votes LEFT JOIN methods ON liste_votes.methode=methods.id WHERE idVotation='" . $idVotation . "'"; $db->query($query); $votes = $db->result->fetch_all(); return $votes; } $idVotation = getpost("id"); if (!empty($idVotation)) { $_SESSION["idVotation"] = $idVotation; $votationName = queryVotationName($db, $idVotation); }elseif (array_key_exists("idVotation", $_SESSION)) { if (!empty($_SESSION["idVotation"])) { $idVotation = $_SESSION["idVotation"]; $votationName = queryVotationName($db, $idVotation); } } print('

') . EOL; print('
'); $votes = queryVotes($db, $idVotation); if (!empty($votes)) { print(""); foreach ($votes as $value) { print ("" . EOL); } print("
"); print("voteméthode
" . $value[1] . "" . $value[5] . "
" . EOL); echo EOLH . EOLH; } print('

Nouveau vote pour la votation'); if (empty($idVotation)) { choixVotation($path, 0, false); }else { print(": " . $votationName . '

' . EOL); $method = getpost("method"); $libelle = getpost("libelle"); if (empty($method) or empty($libelle)) { votesForm($path); }else { $query = "INSERT INTO liste_votes VALUES (0, '" . $libelle . "', " . $method . "," . $idVotation . ")"; print($query); $db->query($query); } } $db->close(); print('
'); require_once("footer.html"); ?>