Files
ms1inscription-v5/club.php
2026-05-13 09:43:32 -04:00

150 lines
3.3 KiB
PHP

<?php
require_once('php/inc_start_time.php');
require_once('php/inc_fonctions.php');
require_once('php/inc_fx_messages.php');
global $objDatabase;
$sql = "SELECT * FROM `resultats_questions` WHERE `que_id` = '3702' AND `que_choix_fr` <> ''";
$arr = $objDatabase->fxGetResults($sql);
$club[] = "ASC Coaching";
$mem_club_trouver = 0;
foreach ($arr as $key => $value) {
$choix = $value["que_choix_fr"];
// echo($value["par_id"]." - ".$choix."<br>-");
$choix = str_replace("\n", '', $choix); // remove new lines
$choix = str_replace("\r", '', $choix);
$choix = trim($choix);
$found = array_search($choix, $club); // $key = 2;
if ($found !== false) {
} else {
// echo("not found");
$mem_club_trouver = $mem_club_trouver + 1;
$club[] = $choix;
}
}
$passe = $arr;
?>
<?php
sort($club);
?>
nouvelle liste de club
<?php
$sql = "SELECT CONCAT (mr.mr_reponse, ' (',m.mem_numero,')') as res,mr.mr_reponse,m.mem_numero FROM memberships m JOIN memberships_reponses mr on mr.mem_numero=m.mem_numero WHERE mt_id = '4' AND mem_actif = '1' and mr.mq_id =15 order by m.mem_numero";
$arr = $objDatabase->fxGetResults($sql);
foreach ($arr as $key => $value) {
$club2[] = $value;
$club2b[] = $value["res"];
$club2search[] = $value["mr_reponse"];
}
//sort($club2b);
?>
<pre>
<?php
print_r($club2b);
?>
</pre>
list club choisie dans le passe
<pre>
<?php
foreach ($club as $key => $value) {
$keyf = array_search($value, $club2search); // $key = 2;
if ($keyf != false) {
$club[$key] = $club2b[$keyf];
}
}
print_r($club);
echo("<br>");
?>
</pre>
list passe
<?php
$afaire=0;
foreach ($passe as $key => $value) {
$choix = $value["que_choix_fr"];
// echo($value["par_id"]." - ".$choix."<br>-");
$choix = str_replace("\n", '', $choix); // remove new lines
$choix = str_replace("\r", '', $choix);
$choix = trim($choix)."";
$found = array_search($choix, $club2search); // $key = 2;
if ($found !== false) {
$mem_club_trouver = $mem_club_trouver + 1;
$passe[$key]['club'] = $club2b[ $found];
$arrcorriger[$afaire]['club']= $club2b[$found];
$arrcorriger[$afaire]['pec_id']= $passe[$key]["pec_id"];
$afaire=$afaire+1;
} else {
$passe[$key]['club'] = 'club existe pas';
}
}
?>
<pre>
<?php
print_r($arrcorriger);
echo("<br>");
?>
</pre>
liste membres via member
<?php
$sql = "SELECT * FROM memberships m JOIN inscriptions_comptes ic on ic.com_id=m.com_id WHERE m.mem_actif=1 and m.mem_club_question<>'' order by m.mem_club_question";
$arr = $objDatabase->fxGetResults($sql);
$list_membre_club[] = "";
if ($arr) {
foreach ($arr as $key => $value) {
$list_membre_club[$key]['mem_club_question'] = $value['mem_club_question'];
$list_membre_club[$key]['nom'] = $value['com_prenom'] . " " . $value['com_nom'];
}
}
//sort($club2b);
?>
<pre>
<?php
print_r($list_membre_club);
?>
</pre>
<?php
// faire la modification dans member
foreach ($arrcorriger as $key => $value) {
$sql = 'update memberships set mem_club_question = "'.$arrcorriger[$key]["club"].'" where pec_id = ' . intval($arrcorriger[$key]["pec_id"]) ;
//echo($sql); echo("<br>");
if(!mysqli_query($objDatabase->con, $sql)){
echo($sql); echo("<br>");}
}
?>