-
Notifications
You must be signed in to change notification settings - Fork 1
/
querySearch.php
58 lines (58 loc) · 2.37 KB
/
querySearch.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
<?php include 'Recherche.php' ?>
<?php
include_once 'const.php';
if(isset($_POST["search"]) && $_POST["search"] != "")
{
include 'card.php';
global $mysqlConnection;
$temp = explode(" ", $_POST["search"]);
//recherche dans les medecins
if(sizeof($temp) > 1)
{
$sql ="SELECT DISTINCT * FROM Medecin JOIN Plage_horraire ON Medecin.ID = Plage_horraire.ID_Medecin WHERE LOWER(Prenom) LIKE '%".$temp[0]."%' OR LOWER(Nom) LIKE '%". $temp[1] ."%' OR LOWER(Prenom) LIKE '%" . $temp[1] . "%' OR LOWER(Nom) LIKE '%" . $temp[0] . "%';";
}
else
{
$sql ="SELECT DISTINCT * FROM Medecin JOIN Plage_horraire ON Medecin.ID = Plage_horraire.ID_Medecin WHERE LOWER(Prenom) LIKE '%".$temp[0]."%' OR LOWER(Nom) LIKE '%". $temp[0] ."%' OR LOWER(Prenom) LIKE '%" . $temp[0] . "%' OR LOWER(Nom) LIKE '%" . $temp[0] . "%';";
}
$memberStatement = $mysqlConnection->prepare($sql);
$memberStatement->execute();
$resultM = $memberStatement->fetchAll();
//recherche dans les services
$sql = "SELECT Nom,Info,Regles FROM Service WHERE LOWER(Nom) LIKE '%" . $_POST["search"] . "%';";
$memberStatement = $mysqlConnection->prepare($sql);
$memberStatement->execute();
$resultS = $memberStatement->fetchAll();
$sql = "SELECT Medecin.*, Specialite.Nom_spe, Plage_horraire.dispo FROM Medecin JOIN Specialite ON Medecin.spe = Specialite.ID_spe JOIN Plage_horraire ON Medecin.ID = Plage_horraire.ID_Medecin WHERE LOWER(Specialite.Nom_spe) LIKE '%" . $_POST["search"] . "%';";
$memberStatement = $mysqlConnection->prepare($sql);
$memberStatement->execute();
$resultService = $memberStatement->fetchAll();
echo("<br>");
echo("<h2>Services</h2>");
foreach($resultS as $res)
{
echo('<div class="SousBoites" style="text-align:left!important">');
echo("<h4>".$res["Nom"] . "</h4><br> " . str_replace("\n", "<br>", $res["Info"]) . "<br><br>". str_replace("\n", "<br>", $res["Regles"]) . "<br/><br/><br/><br/>");
echo('</div><br>');
}
echo("<br>");
echo("<h2>Médecins</h2>");
echo('<div id="deroulant" style="background-color : var(--fond2);">');
foreach($resultService as $res)
{
card($res);
}
foreach($resultM as $res)
{
card($res);
}
echo('</div><br>');
}
else
{
die;
}
echo("</p></div> </section> </div>");
include 'footer.php';
echo(" </body> </html>");
?>