mirror of
https://gitlab.aliens-lyon.fr/savrillo/gpens.git
synced 2026-03-18 00:31:03 +01:00
Ajout des requetes PHP/SQL pour rechercher.
This commit is contained in:
parent
bc6195600d
commit
9406374cbe
@ -15,7 +15,7 @@ try {
|
||||
}
|
||||
|
||||
|
||||
if($_GET["salle"] != NULL) {
|
||||
if(isset($_GET["salle"])) {
|
||||
|
||||
$idSalle = $_GET["salle"];
|
||||
|
||||
@ -50,6 +50,36 @@ if($_GET["salle"] != NULL) {
|
||||
echo (json_encode($out));
|
||||
}
|
||||
|
||||
} else if (isset($_GET["salleNameSearch"])){
|
||||
|
||||
$salleNameSearch = $_GET["salleNameSearch"];
|
||||
|
||||
$stmt = $conn->prepare("(SELECT id, nom FROM `salles` WHERE MATCH nom AGAINST (? IN BOOLEAN MODE)) UNION (SELECT salleID, nom FROM salleAlias WHERE MATCH nom AGAINST (? IN BOOLEAN MODE))");
|
||||
$stmt->execute([$salleNameSearch, $salleNameSearch]);
|
||||
$res = $stmt->fetchAll();
|
||||
|
||||
$out = array();
|
||||
|
||||
for($i=0;$i<count($res);$i++)
|
||||
$out[$i] = array("id" => $res[$i]['id'], "nom" => $res[$i]["nom"]);
|
||||
|
||||
echo (json_encode($out));
|
||||
|
||||
} else if (isset($_GET["salleLocSearch"])) {
|
||||
|
||||
$salleLocSearch = $_GET["salleLocSearch"];
|
||||
|
||||
$stmt = $conn->prepare("SELECT salle, personne FROM `locataires` WHERE MATCH personne AGAINST (? IN BOOLEAN MODE)");
|
||||
$stmt->execute([$salleLocSearch]);
|
||||
$res = $stmt->fetchAll();
|
||||
|
||||
$out = array();
|
||||
|
||||
for($i=0;$i<count($res);$i++)
|
||||
$out[$i] = array("salle" => $res[$i]['salle'], "personne" => $res[$i]["personne"]);
|
||||
|
||||
echo (json_encode($out));
|
||||
|
||||
}else {
|
||||
echo "Je ne connais pas cette commande ...";
|
||||
}
|
||||
|
||||
15
viewer.html
15
viewer.html
@ -6,7 +6,11 @@
|
||||
<title>perdu.html</title>
|
||||
<style>
|
||||
|
||||
#selectedSalleInfos {
|
||||
#searchResultInfos {
|
||||
background-color: #BBBBBB;
|
||||
}
|
||||
|
||||
#selectedSalleInfos {
|
||||
background-color: #BBBBBB;
|
||||
line-height: 150%;
|
||||
}
|
||||
@ -139,10 +143,17 @@
|
||||
Il faut que vous sélectionnez une salle.
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<form>
|
||||
<input name="searchString" type="text"/>
|
||||
<label for="salleNameSearch">Rechercher par nom de salle : </label> <input name="salleNameSearch" type="text" id="salleNameSearch"/> <input name=salleNameButton" type=button value="Rechercher" onclick="salleNameSearch" />
|
||||
<br/>
|
||||
<label for="salleLocSearch">Rechercher par locataire : </label> <input name="salleLocSearch" type="text" id="salleLocSearch"/> <input name=salleLocButton" type=button value="Rechercher" onclick="salleLocSearch" />
|
||||
</form>
|
||||
|
||||
<div id="searchResultInfos">
|
||||
Il faut que vous fassiez une recherche.
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user