MOD MySQL est remplacé par PostgreSQL (fini)
[cl7.git] / php / pages / inscrits.php
index ad26645..a28efdb 100644 (file)
@@ -2,20 +2,20 @@
 
 include_once("php/traitement_pre_affichage.php");
 
-$participants = mysql_query("
+$participants = pg_query("
    SELECT id, pseudo, nom, prenom, clan_nom, clan_tag, remarques
    FROM participants
-   ORDER by clan_nom, clan_tag, pseudo
+   ORDER by clan_nom NULLS FIRST, clan_tag NULLS FIRST, pseudo
 ");
 
-$periodes = mysql_query("SELECT nom_abrege FROM periodes ORDER BY id");
+$periodes = pg_query("SELECT nom_abrege FROM periodes ORDER BY id");
 $debut_table = '
  <tr>
   <th>pseudo</th>
   <th>nom</th>
   <th>prĂ©nom</th>';
 $nb_periode = 0;
-while($periode = mysql_fetch_object($periodes))
+while($periode = pg_fetch_object($periodes))
 {
    $debut_table .= '<th>'.$periode->nom_abrege.'</th>';
    $nb_periode++;
@@ -23,10 +23,10 @@ while($periode = mysql_fetch_object($periodes))
 $debut_table .= '<th>remarques</th>
  </tr>';
  
-$clan_courant = null;
+$clan_courant = "PHP c'est du CACA";
 
 echo '<table class="inscrits">';
-while($participant = mysql_fetch_object($participants))
+while($participant = pg_fetch_object($participants))
 {  
    if ($clan_courant !== $participant->clan_nom)
    {
@@ -34,18 +34,18 @@ while($participant = mysql_fetch_object($participants))
       $clan_courant = $participant->clan_nom;
    }
    
-   $participations = mysql_query("
+   $participations = pg_query_params("
       SELECT periodes.nom, participations.participant_id FROM periodes
-      LEFT JOIN participations ON periodes.id = participations.periode_id AND participations.participant_id = ".$participant->id."
+      LEFT JOIN participations ON periodes.id = participations.periode_id AND participations.participant_id = $1
       ORDER BY id
-   ");
+   ", array($participant->id));
    
    echo '<tr>';
    echo '<td>', htmlentities($participant->clan_tag, ENT_QUOTES, "UTF-8"), traitement_pre_affichage($participant->pseudo), '</td>';
    echo '<td>', traitement_pre_affichage($participant->nom), '</td>';
    echo '<td>', traitement_pre_affichage($participant->prenom), '</td>';
-   while ($participation = mysql_fetch_object($participations))
-     echo '<td '.($participation->participant_id == $participant->id ? 'class="participe"' : '').'></td>';
+   while ($participation = pg_fetch_object($participations))
+      echo '<td '.($participation->participant_id == $participant->id ? 'class="participe"' : '').'></td>';
    
    echo '<td>', traitement_pre_affichage($participant->remarques), '</td>';
    echo '</tr>';