You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ConsEco/Sources/API/api/inscrit/read.php

35 lines
907 B

<?php
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
include_once '../../config/Database.php';
include_once '../../models/Inscrit.php';
$database = new Database();
$db = $database->connect();
$inscrit = new Inscrit($db);
$results = $inscrit->read();
$num = $results->rowCount();
if($num > 0){
$inscrit_array = array();
while($row = $results->fetch(PDO::FETCH_ASSOC)){
extract($row);
$inscrit_item = array(
'id' => $id,
'nom' => $nom,
'prenom' => $prenom,
'mail' => $mail,
'mdp' => $mdp
);
array_push($inscrit_array, $inscrit_item);
}
echo json_encode($inscrit_array);
} else {
echo json_encode(array('message' => 'No Inscrit Found'));
}
?>