getMessage ()); if ($DEBUG == 1) echo "La base ".$dsn ['database']." est connectée.
"; // COLLECTIVITE $res = $db -> query ($sql_collectivite); if (DB :: isError ($res)) die ($res -> getMessage ()." erreur ".$sql_collectivite); $row =& $res -> fetchRow (); $ville = $row [0]; $res -> free (); // HEADER HTML echo "\n"; echo "\t\n"; include ("../dyn/entete.inc"); echo "\t\n"; echo "\t\n"; echo "
"; if($validation==0){ echo $export; echo "
"; echo "upload"; echo " "; echo "
"; }else{ /* $sql= "select * from election where election ='".$_SESSION['election']['election']."'"; $res = $db -> query ($sql); if (DB :: isError ($res)) die ($res -> getMessage ()." Erreur ".$sql); else { $row =& $res -> fetchRow (); $export = "UPDATE `election` SET `election` = '".$_SESSION['election']['election']. "', `typeelection` = '".$row[1]. "', `election_date` = '".$row[2]. "', `election_libelle` = '".$row[3]. "', `election_tour` = ".$row[4]. ", `election_canton` = '".$row[5]. "', `election_nbcandidat` = ".$row[6]. ", `election_h_ouver` = '".$row[7]. "', `election_h_ferm` = '".$row[8]. "', `election_simulation` = ".$row[9]. ", `election_cloture` = ".$row[10]. ", `election_nbinscrit` = ".$row[11]. ", `election_nbvotant` = ".$row[12]. ", `election_nbnul` = ".$row[13]. ", `election_nbexprime` = ".$row[14]. ", `election_commentaire` = '' WHERE `election` = '".$_SESSION['election']['election']."';"; } */ //UPDATE `election` SET `election` = 'PRE07-2C', `typeelection` = 'PRE', `election_date` = '2007-05-06', `election_libelle` = 'Presidentielles 2e tour 1C', `election_tour` = 2, `election_canton` = 'T', `election_nbcandidat` = 2, `election_h_ouver` = '08:00:00', `election_h_ferm` = '18:00:00', `election_simulation` = -1, `election_cloture` = 0, `election_nbinscrit` = 0, `election_nbvotant` = 0, `election_nbnul` = 0, `election_nbexprime` = 0, `election_commentaire` = '' WHERE `election` = 'PRE07-2C'; //resultat $sql= "select * from resultat where election ='".$_SESSION['election']['election']."'"; $res = $db -> query ($sql); if (DB :: isError ($res)) die ($res -> getMessage ()." Erreur ".$sql); else { while ($row=& $res->fetchRow()){ $export=$export."\n UPDATE resultat SET election = '".$row[0]. "', bureau = ".$row[1]. ", etat = '".addslashes($row[2]). "', inscrit = ".$row[3]. ", votant = ".$row[4]. ", exprime = ".$row[5]. ", nul = ".$row[6]. ", candidat1 = ".$row[7]. ", candidat2 = ".$row[8]. ", candidat3 = ".$row[9]. ", candidat4 = ".$row[10]. ", candidat5 = ".$row[11]. ", candidat6 = ".$row[12]. ", candidat7 = ".$row[13]. ", candidat8 = ".$row[14]. ", candidat9 = ".$row[15]. ", candidat10 = ".$row[16]. ", candidat11 = ".$row[17]. ", candidat12 = ".$row[18]. ", candidat13 = ".$row[19]. ", candidat14 = ".$row[20]. ", candidat15 = ".$row[21]. ", candidat16 = ".$row[22]. ", candidat17 = ".$row[23]. ", candidat18 = ".$row[24]. ", candidat19 = ".$row[25]. ", candidat20 = ".$row[26]. ", candidat21 = ".$row[27]. ", candidat22 = ".$row[28]. ", candidat23 = ".$row[29]. ", candidat24 = ".$row[30]. ", candidat25 = ".$row[31]. ", candidat26 = ".$row[32]. ", candidat27 = ".$row[33]. ", candidat28 = ".$row[34]. ", candidat29 = ".$row[35]. ", candidat30 = ".$row[36]. " WHERE election = '".$row[0]. "' AND bureau = ".$row[1].";"; }} // resultat 1ere centaine $sql= "select * from resultat where election ='".$_SESSION['election']['election']."C'"; $res = $db -> query ($sql); if (DB :: isError ($res)) die ($res -> getMessage ()." Erreur ".$sql); else { while ($row=& $res->fetchRow()){ $export=$export."\n UPDATE resultat SET election = '".$row[0]. "', bureau = ".$row[1]. ", etat = '".addslashes($row[2]). "', inscrit = ".$row[3]. ", votant = ".$row[4]. ", exprime = ".$row[5]. ", nul = ".$row[6]. ", candidat1 = ".$row[7]. ", candidat2 = ".$row[8]. ", candidat3 = ".$row[9]. ", candidat4 = ".$row[10]. ", candidat5 = ".$row[11]. ", candidat6 = ".$row[12]. ", candidat7 = ".$row[13]. ", candidat8 = ".$row[14]. ", candidat9 = ".$row[15]. ", candidat10 = ".$row[16]. ", candidat11 = ".$row[17]. ", candidat12 = ".$row[18]. ", candidat13 = ".$row[19]. ", candidat14 = ".$row[20]. ", candidat15 = ".$row[21]. ", candidat16 = ".$row[22]. ", candidat17 = ".$row[23]. ", candidat18 = ".$row[24]. ", candidat19 = ".$row[25]. ", candidat20 = ".$row[26]. ", candidat21 = ".$row[27]. ", candidat22 = ".$row[28]. ", candidat23 = ".$row[29]. ", candidat24 = ".$row[30]. ", candidat25 = ".$row[31]. ", candidat26 = ".$row[32]. ", candidat27 = ".$row[33]. ", candidat28 = ".$row[34]. ", candidat29 = ".$row[35]. ", candidat30 = ".$row[36]. " WHERE election = '".$row[0]. "' AND bureau = ".$row[1].";"; }} //resultat $sql= "select * from participation where election ='".$_SESSION['election']['election']."'"; $res = $db -> query ($sql); if (DB :: isError ($res)) die ($res -> getMessage ()." Erreur ".$sql); else { while ($row=& $res->fetchRow()){ $export=$export."\n UPDATE participation SET election = '".$row[0]. "', tranche = '".$row[1]. "', `b1` = ".$row[2]. ", `b2` = ".$row[3]. ", `b3` = ".$row[4]. ", `b4` = ".$row[5]. ", `b5` = ".$row[6]. ", `b6` = ".$row[7]. ", `b7` = ".$row[8]. ", `b8` = ".$row[9]. ", `b9` = ".$row[10]. ", `b10` = ".$row[11]. ", `b11` = ".$row[12]. ", `b12` = ".$row[13]. ", `b13` = ".$row[14]. ", `b14` = ".$row[15]. ", `b15` = ".$row[16]. ", `b16` = ".$row[17]. ", `b17` = ".$row[18]. ", `b18` = ".$row[19]. ", `b19` = ".$row[20]. ", `b20` = ".$row[21]. ", `b21` = ".$row[22]. ", `b22` = ".$row[23]. ", `b23` = ".$row[24]. ", `b24` = ".$row[25]. ", `b25` = ".$row[26]. ", `b26` = ".$row[27]. ", `b27` = ".$row[28]. ", `b28` = ".$row[29]. ", `b29` = ".$row[30]. ", `b30` = ".$row[31]. ", `b31` = ".$row[32]. ", `b32` = ".$row[33]. ", `b33` = ".$row[34]. ", `total` = ".$row[35]. " WHERE `election` = '".$row[0]. "' AND `tranche` = '".$row[1]. "';"; }} // ecriture des fichiers en tmp $fichier = "../trs/export.sql"; $inf = fopen($fichier,"w"); //$export=substr($export,0,strlen($export)-1); // un \n en trop fwrite($inf,$export); fclose($inf); echo "sauvegarde ok
"; $affiche= str_replace(';','
',$export); echo $affiche; }//fin validation //======================================================================= echo "
"; // DECONNEXION BDD $db -> disconnect (); if ($DEBUG == 1) echo "La base ".$dsn ['database']." est déconnectée.
"; // FOOTER HTML echo "\n\t\n"; echo "\n"; ?>