LPDLIS/tp-bd-files/webapp/admin/print_clients.php
Francois Lesueur 2d38bac294 bootstrap
2023-01-04 15:13:50 +01:00

46 lines
1.3 KiB
PHP

<?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
$query = 'SELECT * FROM clients';
$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>Comment</td><td>Role</td><td>Supprimer</td>\n";
while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) {
$id=$line['id'];
$name=$line['name'];
$email=$line['email'];
$comment=$line['comment'];
$role=$line['role'];
echo "\t<tr><td>$name</td><td>$email</td><td>$comment</td><td>$role</td>\n";
echo "\t<td><a href=do_support.php?delete=".$id.">Supprimer</a></td></tr>\n";
}
echo "</table>\n";
// Libère le résultat
pg_free_result($result);
// Ferme la connexion
pg_close($dbconn);
?>
<br/><br/>
Ajouter un client :<br/>
<form action=do_support.php method=post>
Name: <input type="text" name="name"><br/>
Password: <input type="text" name="password"><br/>
Role: <input type="text" name="role"><br/>
Email: <input type="text" name="email"><br/>
Comment: <input type="text" name="comment"><br/>
<input type="submit" value="Submit">
</form>