Commentaire code

master
PALAFFRE Raphaël 6 years ago
parent 7c73030e97
commit bd4163c5fa

@ -1,4 +1,5 @@
<?php <?php
//Importation des fichiers
session_start(); session_start();
require_once("../connexionBD.php"); require_once("../connexionBD.php");
require_once("../ressources/user.php"); require_once("../ressources/user.php");
@ -8,13 +9,18 @@ if (!isset($_SESSION['mail'])) {
header('Location: ../index.php'); header('Location: ../index.php');
exit(); exit();
} }
//Recuperation variable session
$mail = $_SESSION['mail']; $mail = $_SESSION['mail'];
$login = getLogin($db, $mail); $login = getLogin($db, $mail);
//Creation et envoie de la requete SQL
$requete = "SELECT DISTINCT Utilisateur.login, Avis.commentaire, Avis.dateavis, Avis.note FROM Utilisateur, Avis, Trajet WHERE Avis.codetrajet = Trajet.codetrajet AND Trajet.mailproposition = $1 AND Trajet.mailproposition = Utilisateur.mail;"; $requete = "SELECT DISTINCT Utilisateur.login, Avis.commentaire, Avis.dateavis, Avis.note FROM Utilisateur, Avis, Trajet WHERE Avis.codetrajet = Trajet.codetrajet AND Trajet.mailproposition = $1 AND Trajet.mailproposition = Utilisateur.mail;";
$result = pg_query_params($db, $requete, array($mail)); $result = pg_query_params($db, $requete, array($mail));
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
@ -26,22 +32,23 @@ $result = pg_query_params($db, $requete, array($mail));
</head> </head>
<body> <body>
<?php require_once ("../ressources/navbarhtml.php"); ?> <?php require_once ("../ressources/navbarhtml.php"); ?>
<div id="container"> <div id="container">
<div id="entete"> <div id="entete"> <-- Entete -->
<a href="../tableauBord/tableauBord.php"><img id="bouton_retour" <a href="../tableauBord/tableauBord.php"><img id="bouton_retour"
src="../ressources/image/return.png" src="../ressources/image/return.png"
alt="Bouton retour"></a> alt="Bouton retour"></a>
<h1 id="titre">Avis Recus</h1> <h1 id="titre">Avis Recus</h1>
<br> <br>
</div> </div>
<div id="avis"> <div id="avis"> <-- Avis recus -->
<table> <table>
<?php while ($row = pg_fetch_array($result)) { <?php while ($row = pg_fetch_array($result)) { //Stockage des valeurs de retour de la requete SQL
$nom = $row['login']; $nom = $row['login'];
$date = $row['dateavis']; $date = $row['dateavis'];
$commentaire = $row['commentaire']; $commentaire = $row['commentaire'];
$note = $row['note']; $note = $row['note'];
echo "<tr>"; echo "<tr>"; //Affichage des resultat sour forme de tableau
echo "<td class='avis_tab'>"; echo "<td class='avis_tab'>";
echo "<h3 id='nom'>$nom</h3>"; echo "<h3 id='nom'>$nom</h3>";
echo "<h4 id='date'>".explode(' ',$date)[0]."</h4>"; echo "<h4 id='date'>".explode(' ',$date)[0]."</h4>";
@ -49,7 +56,7 @@ $result = pg_query_params($db, $requete, array($mail));
echo "</td>"; echo "</td>";
echo "<td id='note_tab'>"; echo "<td id='note_tab'>";
$i=0; $i=0;
while ($i<intval($note)){ while ($i<intval($note)){ //Affichage des notes recus
echo "<img class='etoile' src='../ressources/image/star_full.png' alt='star'>"; echo "<img class='etoile' src='../ressources/image/star_full.png' alt='star'>";
$i++; $i++;
} }

Loading…
Cancel
Save