diff --git a/2020-2021/TD8/ajout.html b/2020-2021/TD8/ajout.html new file mode 100644 index 0000000..7f941fb --- /dev/null +++ b/2020-2021/TD8/ajout.html @@ -0,0 +1,16 @@ + + + + + Ajout d'une entrée + + +
+
+
+
+ + +
+ + \ No newline at end of file diff --git a/2020-2021/TD8/ajoutEntree.php b/2020-2021/TD8/ajoutEntree.php new file mode 100644 index 0000000..5351c44 --- /dev/null +++ b/2020-2021/TD8/ajoutEntree.php @@ -0,0 +1,12 @@ +connect_errno){ + die("Connexion impossible"); +}else{ + echo "Connexion OK"; +} + +$insert = "INSERT INTO ANNUAIRE (nom,prenom,numPost) VALUES (?,?,?)"; +$stmt = $connect->prepare($insert); +$stmt->bind_param("sss",$_POST["nom"],$_POST["prenom"],$_POST["numpost"]); +$stmt->execute(); \ No newline at end of file diff --git a/2020-2021/TD8/createTable.php b/2020-2021/TD8/createTable.php new file mode 100644 index 0000000..18a7202 --- /dev/null +++ b/2020-2021/TD8/createTable.php @@ -0,0 +1,15 @@ +connect_errno) { + die("Connexion impossible"); +} else { + echo "Connexion OK"; +} +$nom = "Bar"; +$rechercheNom = "SELECT * from ANNUAIRE WHERE nom like'" . $nom . "%'"; +$SearchPrenome = "SELECT * from ANNUAIRE WHERE nom like'" . $prenom . "%'"; +$result = $connect->query($rechercheNom); +while ($r = $result->fetch_assoc()) { + echo '
' . $r["nom"] . " " . $r["prenom"] . " " . $r["numPost"] . " " . $r["id"]; +} +$connect->close(); diff --git a/2020-2021/TD8/database.php b/2020-2021/TD8/database.php new file mode 100644 index 0000000..482c5e2 --- /dev/null +++ b/2020-2021/TD8/database.php @@ -0,0 +1,23 @@ + diff --git a/2020-2021/TD8/index.html b/2020-2021/TD8/index.html new file mode 100644 index 0000000..84f36de --- /dev/null +++ b/2020-2021/TD8/index.html @@ -0,0 +1,14 @@ + + + + + Menu + + +

Que voulez vous faire

+ Recehercher une entrée + Ajouter une entrée + Modifier numero de poste + Supprimer une entrée + + \ No newline at end of file diff --git a/2020-2021/TD8/modifier.php b/2020-2021/TD8/modifier.php new file mode 100644 index 0000000..de66623 --- /dev/null +++ b/2020-2021/TD8/modifier.php @@ -0,0 +1,15 @@ +connect_errno){ + die("Connexion impossible"); +}else{ + echo "Connexion OK".'
'; +} + +$sql ="UPDATE ANNUAIRE SET numPost='".$_POST["numpost"]."' WHERE nom='".$_POST["nom"]."' and prenom='".$_POST["prenom"]."'"; +if($connect->query($sql)===TRUE && $connect->affected_rows>0){ + echo "Mise à jour OK".'
'; +} +else{ + echo "Erreur lors de la mise à jour : ".$connect->error; +} diff --git a/2020-2021/TD8/modifnumpost.html b/2020-2021/TD8/modifnumpost.html new file mode 100644 index 0000000..57220a1 --- /dev/null +++ b/2020-2021/TD8/modifnumpost.html @@ -0,0 +1,16 @@ + + + + + Modifier un numero de poste + + +
+
+
+
+ + +
+ + \ No newline at end of file diff --git a/2020-2021/TD8/recherche.html b/2020-2021/TD8/recherche.html new file mode 100644 index 0000000..8de729a --- /dev/null +++ b/2020-2021/TD8/recherche.html @@ -0,0 +1,15 @@ + + + + + recherche dans table ANNUAIRE + + +
+
+
+ + +
+ + \ No newline at end of file diff --git a/2020-2021/TD8/rechercheTable.php b/2020-2021/TD8/rechercheTable.php new file mode 100644 index 0000000..389ab91 --- /dev/null +++ b/2020-2021/TD8/rechercheTable.php @@ -0,0 +1,29 @@ +connect_errno){ + die("Connexion impossible"); +}else{ + echo "Connexion OK"; +} +$nom="Bar"; +$rechercheNom = "SELECT * from ANNUAIRE WHERE nom like'". $_POST["nom"]."%'"; +$recherchePrenom = "SELECT * from ANNUAIRE WHERE nom like'".$_POST["prenom"]."%'"; +$rechercheNomEtPrenom= "SELECT * from ANNUAIRE WHERE prenom like'".$_POST["prenom"]."%' and nom like'". $_POST["nom"]."%'"; +if(!empty($_POST["prenom"]) && !empty($_POST["nom"])){ + $result = $connect->query($rechercheNomEtPrenom); +} +elseif (!empty ($_POST["prenom"])) $result = $connect->query($recherchePrenom); +elseif ( !empty ($_POST["nom"])) $result = $connect->query($rechercheNom); +echo '
'."Resultat de la recherche"; +while($r=$result->fetch_assoc()) { + echo '
'.$r["nom"]." ".$r["prenom"]." ".$r["numPost"]." ".$r["id"]; +} + + + + + + + +$connect->close(); + diff --git a/2020-2021/TD8/supprimer.html b/2020-2021/TD8/supprimer.html new file mode 100644 index 0000000..54ea22a --- /dev/null +++ b/2020-2021/TD8/supprimer.html @@ -0,0 +1,15 @@ + + + + + Supprimer une entrée + + +
+
+
+ + +
+ + \ No newline at end of file diff --git a/2020-2021/TD8/supprimer.php b/2020-2021/TD8/supprimer.php new file mode 100644 index 0000000..6b1ae9f --- /dev/null +++ b/2020-2021/TD8/supprimer.php @@ -0,0 +1,14 @@ +connect_errno) { + die("Connexion impossible"); +} else { + echo "Connexion OK" . '
'; +} + +$sql = "DELETE FROM ANNUAIRE WHERE nom='" . $_POST["nom"] . "' and prenom='" . $_POST["prenom"] . "'"; +if ($connect->query($sql) === TRUE && $connect->affected_rows > 0) { + echo "Suppression OK" . '
'; +} else { + echo "Erreur lors suppression : " . $connect->error; +}