-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.php
executable file
·116 lines (95 loc) · 3.76 KB
/
search.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="RESSOURCES/css/search.css">
<title>Document</title>
</head>
<body>
<?php
require 'db.php';
include("navbar.php");
if (isset($_POST['search'])) {
?>
<table class="table table-bordered">
<head class="alert-info">
</head>
<body>
<?php
session_start();
$keyword = $_POST['keyword'];
$query = $db->prepare("SELECT * FROM courses WHERE titre LIKE '%$keyword%' or description LIKE '%$keyword%' or categorie LIKE '%$keyword%'");
$query->execute();
while ($row = $query->fetch()) {
?>
<a class="carte_cours" href="<?php echo $row['url_cours']; ?>">
<div class="cours_image">
<img src="cours/101/phpcourse.webp"" alt="">
</div>
<div class=" cours_text">
<div class="titre_cat">
<h1 style="font-size: 200%;"><?php echo $row['titre']; ?></h1>
<h2 style="font-size: 150%;"><?php echo $row['categorie']; ?></h2>
</div>
<h3 style=""><?php echo $row['description']; ?></h3>
<!-- <h4 style="font-size: 120%;"><?php echo $row['id_ens']; ?></h4> -->
</div>
<div class="cours_desc">
<div class="duree_cours">
<img src="RESSOURCES/css/img/duree.png" alt="">
<h3><?php echo $row['duree']; ?> heures</h3>
</div>
<div class="diff_cours">
<img src="RESSOURCES/css/img/diff.png" alt="" height="15px" width="auto">
<h3><?php
if ($row['difficulte'] == 1) {
echo 'facile';
} else if ($row['difficulte'] == 2) {
echo 'moyen';
} else {
echo 'difficile';
}
?>
</h3>
</div>
</div>
</a>
<?php
}
?>
</body>
</table>
<?php
} else {
?>
<table class="table table-bordered">
<thead class="alert-info">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Address</th>
</tr>
</thead>
<tbody>
<?php
$query = $db->prepare("SELECT * FROM `member`");
$query->execute();
while ($row = $query->fetch()) {
?>
<tr>
<td><?php echo $row['titre'] ?></td>
<td><?php echo $row['categorie'] ?></td>
<td><?php echo $row['descrition'] ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
}
?>
</body>
</html>