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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| <?php
//Connexion à la base de données
include 'connect.php';
$connexion = mysqli_connect($DB_HOST, $DB_USER, $DB_PASSWORD, $DB_NAME )or die ("erreur");
mysqli_connect($DB_HOST, $DB_USER, $DB_PASSWORD, $DB_NAME )or die ("erreur");
$sql = "SELECT * FROM `" . $DB_TABLE_NAME . "`";
$req = mysqli_query($connexion, $sql) or die(mysqli_error($connexion));
mysqli_close($connexion);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1" />
<title>Modification "Inline" d'éléments dans une page web</title>
<link rel="StyleSheet" type="text/css" href="index.css"/>
<script type="text/javascript" src="inlinemod.js"></script>
</head>
<body>
<h1>Répertoire des initiés</h1>
<table id="table-utilisateurs">
<tr>
<th>Nom</th>
<th>Prénom</th>
<th>Adresse</th>
<th>Code Postal</th>
<th>Ville</th>
<th>Niveau</th>
<th>Email</th>
</tr>
<?php
while ($user = mysqli_fetch_assoc($req))
echo $sql;
{
?>
<tr>
<td id="nom-<?php echo $user['id']; ?>" class="cellule" ondblclick="inlineMod(<?php echo $user['id']; ?>, this, 'nom', 'texte')"><?php echo $user['nom']; ?></td>
<td id="prenom-<?php echo $user['id']; ?>" class="cellule" ondblclick="inlineMod(<?php echo $user['id']; ?>, this, 'prenom', 'texte')"><?php echo $user['prenom']; ?></td>
<td id="adresse-<?php echo $user['id']; ?>" class="cellule" ondblclick="inlineMod(<?php echo $user['id']; ?>, this, 'adresse', 'texte-multi')"><?php echo $user['adresse']; ?></td>
<td id="cp-<?php echo $user['id']; ?>" class="cellule" ondblclick="inlineMod(<?php echo $user['id']; ?>, this, 'code_postal', 'texte')"><?php echo $user['code_postal']; ?></td>
<td id="ville-<?php echo $user['id']; ?>" class="cellule" ondblclick="inlineMod(<?php echo $user['id']; ?>, this, 'ville', 'texte')"><?php echo $user['ville']; ?></td>
<td id="niveau-<?php echo $user['id']; ?>" class="cellule" ondblclick="inlineMod(<?php echo $user['id']; ?>, this, 'niveau', 'nombre')"><?php echo $user['niveau']; ?></td>
<td id="email-<?php echo $user['id']; ?>" class="cellule" ondblclick="inlineMod(<?php echo $user['id']; ?>, this, 'email', 'texte')"><?php echo $user['email']; ?></td>
</tr>
<?php
}
?>
</table>
<div id="info">(les données de ce tableau sont fictives)</div>
</body>
</html> |
Partager