-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhotels.php
125 lines (105 loc) · 3.53 KB
/
hotels.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
<style>
table{
border: 1px solid grey;
}
td{
border-bottom: 1px solid grey;
width: 150px;
text-align: center;
padding: 10px;
}
.head{
font-weight: bold;
border-bottom: 2px black solid;
}
span{
color: white;
font-weight: 300;
width: 30px;
padding:5px 20px 5px 20px;
height: 15px;
border-radius: 15px;
}
button{
color: white;
width: 80px;
height: 30px;
border: 0px;
border-radius: 13px;
margin-right:3px;
}
.btn1{
background-color:purple;
}
.btn2{
background-color:pink;
}
a{
color:white;
text-decoration:none;
}
.btn{
float:right;
border-radius: 0px;
background-color:green;
}
</style>
</style>
</head>
<body style="background-color:beige; ">
<button class="btn" ><a href="ajoutter.html">Ajouter</a></button>
<table cellspacing="0" style="padding-top:30px" >
<tr >
<td class="head">Hotel</td>
<td class="head">Numero</td>
<td class="head">Adresse</td>
<td class="head">Prix par nuit</td>
<td class="head" >Etoile</td>
<td class="head">Nombre de place</td>
<td class="head">operation</td>
</tr>
<?php
$host='localhost';
$dbname='hotels';
$username='root';
$passe='Farah@123';
$connexion= new PDO("mysql:host=$host; dbname=$dbname",$username, $passe);
$requet = $connexion ->query("select * from hotel;");
$data= $requet-> fetchAll(PDO::FETCH_ASSOC);
?>
<?php foreach ($data as $x):?>
<tr>
<td><?php echo $x['id_hotel']?></td>
<td><?php echo $x['name']?></td>
<td><?php echo $x['adresse']?></td>
<td><?php echo $x['prix_par_nuit']?></td>
<td><span >
<?php
$b=$x['nbre_etoile'];
if ($b<3){
echo "<span style='background-color:red;'>$b</span>";
}if ($b<5 and $b>=3){
echo "<span style='background-color:yellow;'>$b</span>";
}if($b>=5) {
echo "<span style='background-color:green;'>$b</span>";
}
?>
</span>
</td>
<td><?php echo $x['nombre_de_place']?></td>
<td style="display:flex; flex-direction:row;">
<button class='btn1'><a href="modifier.php?id_hotel=<?php echo $x['id_hotel']?>">Modifier</a></button>
<button class='btn2'><a href="supprimer.php?id_hotel=<?php echo $x['id_hotel']?> ">supprimer</a></button>
</td>
</tr>
<?php endforeach; ?>
</table>
</body>
</html>