From de10eb8046298673b31ff05a369ff083b863d308 Mon Sep 17 00:00:00 2001 From: Daniel Tartavel Date: Wed, 21 Sep 2022 21:05:44 +0200 Subject: [PATCH] debug --- gestion/saisieVotes.php | 25 ++++++++++++++++++++----- include/fonctions.inc.php | 2 +- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/gestion/saisieVotes.php b/gestion/saisieVotes.php index 60ef167..eb627ba 100644 --- a/gestion/saisieVotes.php +++ b/gestion/saisieVotes.php @@ -18,6 +18,14 @@ function queryVotationName($db, $idVotation) :string return $votationLine["libelle"]; } +function queryVotes($db, $idVotation) :array +{ + $query = "SELECT * FROM liste_votes WHERE id='" . $idVotation . "'"; + $db->query($query); + $votes = $db->result->fetch_assoc(); + return $votes; +} + $idVotation = getpost("id"); if (!empty($idVotation)) { @@ -37,8 +45,15 @@ print('

') . EOL; print('
-
-

Nouveau vote pour la votation'); +
'); +$votes = queryVotes($db, $idVotation); +foreach ($votes as $value) +{ + print ($value[0] . " " . $value[1] . EOLH); +} +echo EOLH . EOLH; + +print('

Nouveau vote pour la votation'); if (empty($idVotation)) { @@ -53,9 +68,9 @@ if (empty($idVotation)) votesForm($path); }else { - $query = "INSERT INTO liste_votes ('libelle', 'method', 'id_votation') VALUES ('" . $libelle . "', '" . $method . "', '" . $idVotation . "')"; - print($query); - //$db->query($query); + $query = "INSERT INTO liste_votes ('libelle', 'method', 'id_votation') VALUES ('" . $libelle . "', '" . $method . "', '" . $idVotation . "')"; + print($query); + $db->query($query); } } $db->close(); diff --git a/include/fonctions.inc.php b/include/fonctions.inc.php index 205ce81..15ab3bc 100644 --- a/include/fonctions.inc.php +++ b/include/fonctions.inc.php @@ -125,7 +125,7 @@ function votesForm($path, $libelle = "", $method = 0) foreach ($methods as $value) { $id = $value["id"]; - if ($id == $method)/saisieVotes.php + if ($id == $method) { print('' . EOL); }else