-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfunctions.php
34 lines (24 loc) · 1.09 KB
/
functions.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
<?php
function checkHoraire($jour,$heure){
$connexion = new PDO('mysql:host=localhost;dbname=reservationsalles',"root","");
$connexion->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION) ;
$requete = $connexion->prepare('SELECT login,titre,description,debut,fin,id_utilisateur
FROM utilisateurs
INNER JOIN reservations
ON utilisateurs.id = reservations.id_utilisateur
WHERE DATE_FORMAT(debut, "%w") = :jour AND DATE_FORMAT(debut, "%k") = :heure '
);
$requete->bindParam(':jour', $jour) ;
$requete->bindParam(':heure', $heure) ;
$requete->execute();
$result = $requete->fetch();
if($result)
{
$_GET['id'] = @$result['id_utilisateur'] ;
echo '<td class="reserv"><a href="reservation.php?id='.$_GET['id'].'">'.$result['login'].','.$result['description'].'</a></td>' ;
}
else{
echo '<td class="dispo" > disponible </td>' ;
}
}
?>