LPDLIS/tp-bd-files/webapp/clients/print_clients.php

38 lines
978 B
PHP
Raw Permalink Normal View History

2023-01-04 15:13:50 +01:00
<?php
session_start();
echo "Login is ". $_SESSION['login'];
echo "&nbsp;<a href=index.php?logout=1>Logout</a><br/><br/>";
require_once("../db.inc.php");
// Affichage de la table des clients
// Exécution de la requête SQL
$login = $_SESSION['login'];
$query = "SELECT * FROM clients WHERE name='$login'";
$result = pg_query($dbconn,$query) or die('Échec de la requête : ' . pg_last_error());
// Affichage des résultats en HTML
echo "<table border=1><tr><td>Name</td><td>Email</td><td>Message</td></tr>\n";
while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) {
$id=$line['id'];
$name=$line['name'];
$email=$line['email'];
$message=$line['message'];
echo "\t<tr><td>$name</td><td>$email</td><td>$message</td></tr>\n";
}
echo "</table>\n";
// Libère le résultat
pg_free_result($result);
// Ferme la connexion
pg_close($dbconn);
?>
Envoyer un message :
<form action=do_message.php method=post>
<input type=text name=message>
<input type=submit>
</form>