Commit a295ecaa0e3d9c27d242a458c17f19cb272beae6
Merge pull request #9 from ClubInfoPolytechLille/#8
Liste des écoles
Showing
1 changed file
with
18 additions
and
44 deletions
Show diff stats
pages/schools.php
1 | +<?php | ||
2 | + require_once("creds.php"); | ||
3 | +?> | ||
1 | <h2>Liste écoles participantes</h2> | 4 | <h2>Liste écoles participantes</h2> |
2 | <?php | 5 | <?php |
3 | -require_once ("creds.php"); | ||
4 | - | ||
5 | -try { | ||
6 | - | ||
7 | - $link = @mysql_connect(__MYSQL_HOSTNAME__, __MYSQL_USERNAME__, __MYSQL_PASSWORD__); | ||
8 | - | ||
9 | - if (!$link) { | ||
10 | - throw new Exception('Impossible de se connecter : ' . mysql_error()); | ||
11 | - } | ||
12 | - | ||
13 | - if (!mysql_select_db('crep', $link)) { | ||
14 | - throw new Exception('Selection de la base de donnees impossible'); | ||
15 | - } | ||
16 | - mysql_query("SET NAMES 'utf8'"); | ||
17 | - $requete = "SELECT DISTINCT `nom`, `circonscription`, `adresse`, `enseignant` FROM `school` ORDER BY nom ASC"; | ||
18 | - | ||
19 | - $resultat = mysql_query($requete); | ||
20 | - | ||
21 | - if (!$resultat) { | ||
22 | - throw new Exception('Résultat vide.'); | ||
23 | - } | ||
24 | - | ||
25 | - mysql_close($link); | 6 | +$ecoles = array( |
7 | + array("nom" => "Condorcet", "adresse" => "Allée Denieppe, Willems", "enseignant" => "Mme Vernier"), | ||
8 | + array("nom" => "Cousteau", "adresse" => "58 Rue de la Fraternité, Marquette", "enseignant" => "Mr Griffon"), | ||
9 | + array("nom" => "Curie Ferry", "adresse" => "41 Rue Chanzy, Saint André", "enseignant" => "Mme Faidherbe"), | ||
10 | + array("nom" => "Curie Ferry", "adresse" => "41 Rue Chanzy, Saint André", "enseignant" => "Mme Pollet"), | ||
11 | + array("nom" => "Jeanne de Flandre", "adresse" => "Jeanne de Flandre, Marquette", "enseignant" => "Mme Dejardin"), | ||
12 | + array("nom" => "Jules Ferry", "adresse" => "241 Rue des Ecoles, Wambrechies", "enseignant" => "Mme Loonis"), | ||
13 | + array("nom" => "Les Peupliers", "adresse" => "23 Avenue des Peupliers, Saint André", "enseignant" => "Mme Lescaillet"), | ||
14 | + array("nom" => "Les Peupliers", "adresse" => "23 Avenue des Peupliers, Saint André", "enseignant" => "Mme Nicolas"), | ||
15 | + array("nom" => "Louise de Bettignies", "adresse" => "102 Avenue de la Liberté, Lambersart", "enseignant" => "Mme Paris"), | ||
16 | + array("nom" => "Marie Curie", "adresse" => "Rue Lannelongue, Hem", "enseignant" => "Mr Guillain"), | ||
17 | + array("nom" => "Petit Prince", "adresse" => "29 Avenue du Général Leclerc, Lys lez Lannois", "enseignant" => "Mme Delcroix"), | ||
18 | + array("nom" => "Samain", "adresse" => "28 Place de la République, Lambersart", "enseignant" => "Mme Vidal") | ||
19 | +); | ||
26 | ?> | 20 | ?> |
27 | 21 | ||
28 | <center> | 22 | <center> |
@@ -31,7 +25,6 @@ try { | @@ -31,7 +25,6 @@ try { | ||
31 | <thead> | 25 | <thead> |
32 | <tr> | 26 | <tr> |
33 | <th>Nom de l'école</th> | 27 | <th>Nom de l'école</th> |
34 | - <th>Circonscription</th> | ||
35 | <th>Adresse</th> | 28 | <th>Adresse</th> |
36 | <th>Enseignant</th> | 29 | <th>Enseignant</th> |
37 | </tr> | 30 | </tr> |
@@ -40,15 +33,12 @@ try { | @@ -40,15 +33,12 @@ try { | ||
40 | <tbody> | 33 | <tbody> |
41 | <?php | 34 | <?php |
42 | 35 | ||
43 | - while ($row = mysql_fetch_assoc($resultat)) { | 36 | + foreach($ecoles as $row) { |
44 | echo '<tr>'; | 37 | echo '<tr>'; |
45 | echo '<td>'; | 38 | echo '<td>'; |
46 | echo '<p>' . $row['nom'] . '</p>'; | 39 | echo '<p>' . $row['nom'] . '</p>'; |
47 | echo '</td>'; | 40 | echo '</td>'; |
48 | echo '<td>'; | 41 | echo '<td>'; |
49 | - echo '<p>' . $row['circonscription'] . '</p>'; | ||
50 | - echo '</td>'; | ||
51 | - echo '<td>'; | ||
52 | echo '<p>' . $row['adresse'] . '</p>'; | 42 | echo '<p>' . $row['adresse'] . '</p>'; |
53 | echo '</td>'; | 43 | echo '</td>'; |
54 | echo '<td>'; | 44 | echo '<td>'; |
@@ -61,19 +51,3 @@ try { | @@ -61,19 +51,3 @@ try { | ||
61 | </tbody> | 51 | </tbody> |
62 | </table> | 52 | </table> |
63 | </center> | 53 | </center> |
64 | -<?php | ||
65 | -} | ||
66 | -catch(Exception $e) { | ||
67 | -?> | ||
68 | -<div class="alert alert-danger" role="alert"> | ||
69 | -Impossible d'afficher la liste des écoles participantes.<br/> | ||
70 | -Merci de rééssayer ultérieurement. | ||
71 | -</div> | ||
72 | -<!-- | ||
73 | -<?php | ||
74 | -echo $e; | ||
75 | -?> | ||
76 | ---> | ||
77 | -<?php | ||
78 | -} | ||
79 | -?> |