-
Notifications
You must be signed in to change notification settings - Fork 0
/
Epreuve_add_v3.php
executable file
·60 lines (49 loc) · 1.67 KB
/
Epreuve_add_v3.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
56
57
58
59
60
<?php
$titre = 'Les dates des épreuves de la discipline Bob';
include('entete.php');
// construction des requêtes
$requete1 = "INSERT INTO LesDisciplines values ('Bob')";
$requete2 = "INSERT INTO LesEpreuves values (120, 'Bob a 2', 'par equipe', 'Bob', 'feminin', 2, to_date('29-02-2016 20:00', 'DD-MM-YYYY HH24:MI'))";
// analyse de la requete 1 et association au curseur
$curseur = oci_parse ($lien, $requete1) ;
// execution de la requete
$ok = @oci_execute ($curseur, OCI_NO_AUTO_COMMIT) ;
// on teste $ok pour voir si oci_execute s'est bien passé
if (!$ok) {
echo LeMessage ("majRejetee")."<br /><br />";
$e = oci_error($curseur);
if ($e['code'] == 1) {
echo LeMessage ("disciplineconnue") ;
} else {
echo LeMessageOracle ($e['code'], $e['message']) ;
}
// terminaison de la transaction : annulation
oci_rollback ($lien) ;
} else {
// analyse de la requete 2 et association au curseur
$curseur = oci_parse ($lien, $requete2) ;
// execution de la requete
$ok = @oci_execute ($curseur, OCI_NO_AUTO_COMMIT) ;
// on teste $ok pour voir si oci_execute s'est bien passé
if (!$ok) {
echo LeMessage ("majRejetee")."<br /><br />";
$e = oci_error($curseur);
if ($e['code'] == 1) {
echo LeMessage ("représentationconnue") ;
}
else {
echo LeMessageOracle ($e['code'], $e['message']) ;
}
// terminaison de la transaction : annulation
oci_rollback ($lien) ;
}
else {
echo LeMessage ("majOk") ;
// terminaison de la transaction : validation
oci_commit ($lien) ;
}
}
// on libère le curseur
oci_free_statement($curseur);
include('pied.php');
?>