-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathafficherParClasse.php
37 lines (33 loc) · 1.11 KB
/
afficherParClasse.php
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
<?php
session_start();
if (!(isset($_SESSION["autoriser"]))) {
header("location:SignInUp.php");
exit();
} else {
include("connexion.php");
$option = isset($_GET["but"]) ? $_GET["but"] : false;
$req = "SELECT * FROM etudiant where Classe='$option'";
$reponse = $pdo->query($req);
if ($reponse->rowCount() > 0) {
$outputs1["etudiants"] = array();
while ($row = $reponse->fetch(PDO::FETCH_ASSOC)) {
$etudiant = array();
$etudiant["cin"] = $row["cin"];
$etudiant["nom"] = $row["nom"];
$etudiant["prenom"] = $row["prenom"];
$etudiant["adresse"] = $row["adresse"];
$etudiant["email"] = $row["email"];
$etudiant["classe"] = $row["Classe"];
array_push($outputs1["etudiants"], $etudiant);
}
// success
$outputs1["success"] = 1;
echo json_encode($outputs1);
} else {
$outputs1["success"] = 0;
$outputs1["message"] = "Pas d'étudiants";
// echo no users JSON
echo json_encode($outputs1);
}
}
//header("location:afficherEtudiantsParClasse.php");