Example #1
0
<?php

include 'GestionUtilisateurs.php';
$m = new GestionUtilisateurs();
$id = $_POST['choix'];
$m->supprimerEtudiant($id);
header('location:GestionUtilisateurs.php');
Example #2
0
<?php

include "GestionUtilisateurs.php";
$id = $_GET['id'];
$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
$age = $_POST['age'];
$classe = $_POST['classe'];
$e = new etudiant($nom, $prenom, $age, $classe);
$m = new GestionUtilisateurs();
$m->modifierEtudiant($id, $e);
header('location:GestionUtilisateurs.php');
Example #3
0
    {
        $Requete = "insert into utilisateur\n\t\t(nom,prenom,age,type,classe)values\n\t\t(\n\t\t'" . $etudiant->getNom() . "',\n\t\t'" . $etudiant->getPrenom() . "',\n\t\t'" . $etudiant->getAge() . "',\n\t\t\t\t'etudiant',\n\t\t'" . $etudiant->classe . "'\t\t\n\t\t)";
        $this->conn->exec($Requete);
    }
    function supprimerEtudiant($id)
    {
        $Requete = "delete from utilisateur where id = '{$id}'";
        $this->conn->exec($Requete);
    }
    function modifierEtudiant($id, $e)
    {
        $Requete = "update utilisateur set \n\t\t\tnom = '" . $e->getNom() . "',prenom = '" . $e->getPrenom() . "',age ='" . $e->getAge() . "',classe = '" . $e->classe . "' where id = '{$id}'";
        $this->conn->exec($Requete);
    }
}
$m = new GestionUtilisateurs();
//$m->ajouterEtudiant($e1);
//$m->supprimerEtudiant(4);
//$m->modifierEtudiant(1, $e1);
$tab = $m->affichage();
?>
	<form method="post" action="suppression.php">
    <?php 
echo '<h1>La liste des étudiants</h1>';
echo "<table border=1>";
echo "<tr>\n\t\t\t<th>nom</th>\n\t\t\t<th>prenom</th>\n\t\t\t<th>age</th>\n\t\t\t<th>classe</th>\n\t\t\t<th>Suppression</th>\n\t\t\t<th>Modification</th>\n\t\t</tr>";
foreach ($tab as $e1) {
    echo "<tr>";
    echo "<td>" . $e1['nom'] . "</td>";
    echo "<td>" . $e1['prenom'] . "</td>";
    echo "<td>" . $e1['age'] . "</td>";