From f8caddc10d70975a9f687fac5d007b340a7a8699 Mon Sep 17 00:00:00 2001 From: viastolfi Date: Sat, 10 Dec 2022 08:35:50 +0100 Subject: [PATCH] ajout d'une route de type post fonctionnelle --- Sources/API/routes/Inscrit.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sources/API/routes/Inscrit.php b/Sources/API/routes/Inscrit.php index 244949f..e7d9ba8 100644 --- a/Sources/API/routes/Inscrit.php +++ b/Sources/API/routes/Inscrit.php @@ -31,7 +31,7 @@ $app->get('/Inscrit', function(Request $request, Response $response){ }); $app->post('/Inscrit/one', function(Request $request, Response $response,array $args){ - $mail = $request->getParsedBody(); + $mail = $request->getParsedBody()["email"]; $query = 'SELECT * FROM Inscrit WHERE mail=:mail'; try{ @@ -39,8 +39,9 @@ $app->post('/Inscrit/one', function(Request $request, Response $response,array $ $conn = $db->connect(); $stmt = $conn->prepare($query); - $stmt->bindValue(':mail',$mail, PDO::PARAM_STR); + $stmt->bindValue(':mail', $mail, PDO::PARAM_STR); + $stmt->execute(); $inscrit = $stmt->fetchAll(PDO::FETCH_OBJ); $db = null;