-
Notifications
You must be signed in to change notification settings - Fork 0
/
traitModification.php
106 lines (74 loc) · 2.97 KB
/
traitModification.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
$cin =$_GET["cin"];
$nom =$_GET["nom"];
$prenom =$_GET["prenom"];
$email =$_GET["email"];
$telephone =$_GET["telephone"];
$date =$_GET["date"];
$sexe=$_GET["optionsRadios"];
$car=$_GET["car"];
$html ="
<head>
<!-- Latest compiled and minified CSS -->
<link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css'
integrity='sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T' crossorigin='anonymous'>
<script src='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js'
integrity='sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM'
crossorigin='anonymous'></script>
<body>
<h3 align='center'>Modification réusssite pour $prenom $nom</h3>
";
echo "$html" ;
$html ="
<table border ='1' align='center' >
<caption> Listes des achat </caption>
<thead>
<tr>
<th>CIN</th>
<th>NOM</th>
<th>PRENOM</th>
<th>DateNaissance</th>
<th>EMAIL</th>
<th>TELEPHONE</th>
<th>GENRE</th>
<th>car</th>
<th>Modif</th>
<th>supp</th>
</tr>
</thead>
";
echo "$html" ;
// Connection à la base de données
$conn = mysqli_connect('localhost', 'root', '', 'agencewfbd');
if (!$conn) {
die('Could not connect to MySQL: ' . mysqli_connect_error());
}
$req = "UPDATE achat SET nom='$nom', prenom='$prenom', email='$email', telephone='$telephone', date='$date', sexe='$sexe', car='$car' WHERE achat.cin = '$cin';";
mysqli_query ($conn,$req);
$result = mysqli_query($conn, 'SELECT * FROM achat');
// Exécution de requête
while (($row = mysqli_fetch_array($result)) != NULL) {
echo '
<tr>
<td>' . $row["cin"] . '</td>
<td>' . $row["nom"] . '</td>
<td>' . $row["prenom"] . '</td>
<td>' . $row["date"] . '</td>
<td>' . $row["email"] . '</td>
<td>' . $row["telephone"] . '</td>
<td>' . $row["sexe"] . '</td>
<td>' . $row["car"] . '</td>
<td><a href=\'modifier.php?cin='. $row["cin"] .'\'><img src=\'modifier.jpg\' width=\'30\' > modifier</a></td>
<td><a href=\'traitSuppression.php?cin='. $row["cin"] .'\'><img src=\'supprimer.jpg\' width=\'30\' > supprimer</a></td>
</tr>
';
}
echo "</table>
<br>
<a href='index.html'> ajouter un achat </a>
";
// Libération de ressource reservé (optionnel)
mysqli_free_result($result);
// Fermeture de connection (optionnel)
mysqli_close($conn);
?>