-
Notifications
You must be signed in to change notification settings - Fork 0
/
EpreuvesDiscipline_v3_2.php
56 lines (53 loc) · 1.85 KB
/
EpreuvesDiscipline_v3_2.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
session_start();
// récupération des variables
$nDossier = $_POST['nDossier'];
$_SESSION['nDossier']=$nDossier;
$titre = "Discpline liée au dossier $nDossier";
include('entete.php');
// construction de la requete permetant d'afficher les discpline liée au dossier
$requete = ("
SELECT distinct discipline FROM JO_INF245.LesBillets natural join JO_INF245.LesEpreuves join lesdossiers using(ndossier) WHERE nDossier = :n
");
// analyse de la requete et association au curseur
$curseur = oci_parse ($lien, $requete) ;
// affectation de la variable
oci_bind_by_name ($curseur,':n', $nDossier);
// execution de la requete
$ok = @oci_execute ($curseur) ;
// on teste $ok pour voir si oci_execute s'est bien passé
if (!$ok) {
// oci_execute a échoué, on affiche l'erreur
$error_message = oci_error($curseur);
echo "<p class=\"erreur\">{$error_message['message']}</p>";
}
else {
// oci_execute a réussi, on fetch sur le premier résultat
$res = oci_fetch ($curseur);
if (!$res) {
// il n'y a aucun résultat
echo "<p class=\"erreur\"><b> Discipline inconnue </b></p>" ;
}
else {
// on affiche la liste des discpline
echo ("
<form action=\"EpreuvesDiscipline_v3_3.php\" method=\"POST\">
<label for=\"inp_discipline\">Veuillez choisir une discipline :</label>
<select name=\"inp_discipline\">" );
// on affiche un résultat et on passe au suivant s'il existe
do {
$discipline = oci_result($curseur,1) ;
echo "<option value=\"$discipline\">".$discipline."</option>\n";
} while (oci_fetch ($curseur));
}
echo(" </select>
<br /><br />
<input type=\"submit\" value=\"Valider\" />
<input type=\"reset\" value=\"Annuler\" />
</form>
");
}
// on libère le curseur
oci_free_statement($curseur);
include('pied.php');
?>