db->query($sql_session_election); $f->databaseError($res); // On affecte les informations dans SESSION [ election] while ($row =& $res->fetchRow()) { $_SESSION['election']['election'] = $row[0]; $_SESSION['election']['nbcandidat'] = $row[1]; $_SESSION['election']['canton'] = $row[2]; $_SESSION['election']['debut'] = $row[3]; $_SESSION['election']['fin'] = $row[4]; $_SESSION['election']['simulation'] = $row[5]; $date = explode("-", $row[6]); $_SESSION['election']['date'] = $date[2]."/".$date[1]."/".$date[0]; $_SESSION['election']['libelle'] = $row[7]; } unset($row); unset($res); // On récupère les informations à insérer dans SESSION [ candidat] $sql_session_candidat = "SELECT election_candidat_ordre, election_candidat.candidat, concat(candidat_nom, ' ', candidat_prenom) FROM election_candidat INNER JOIN candidat ON candidat.candidat = election_candidat.candidat WHERE election = '".$idx."'"; // On exécute la requête $res = $f->db->query($sql_session_candidat); $f->databaseError($res); // On affecte les informations dans SESSION [ election] while ($row =& $res->fetchRow()) { $_SESSION['candidat'][$row[0]]['candidat'] = $row[1]; $_SESSION['candidat'][$row[0]]['nom'] = $row[2]; } unset($row); unset($res); // On récupère un tableau contenant tous les bureaux du canton choisi if (isset ($_SESSION['election'])) { // $listebureau = ""; // $sql_listebureau = "SELECT bureau, bureau_libelle FROM bureau "; if ($_SESSION['election']['canton'] != 'T') { $sql_listebureau .= "WHERE canton = '".$_SESSION['election']['canton']."'"; } // $res = $f->db->query($sql_listebureau); $f->databaseError($res); $k = 0; while ($row =& $res->fetchRow()) { $listebureau[$k]['code'] = $row[0]; $listebureau[$k]['lib'] = $row[1]; $k++; } $res->free(); // $_SESSION['election']['bureaux'] = $listebureau; // unset($row); unset($res); } // Redirection if ($_GET['obj']=="saisie_election") { header("Location:../scr/saisie.php"); } else { header("Location:../scr/election.php?obj=".$_GET['obj']."&idx=".$_GET['idx'].""); } ?>