diff --git a/website/public/API/nietSlecht.php b/website/public/API/nietSlecht.php new file mode 100644 index 0000000..e37c8e0 --- /dev/null +++ b/website/public/API/nietSlecht.php @@ -0,0 +1,41 @@ +prepare(" + SELECT + `userID` + FROM + `niet_slecht` + WHERE + `postID` = :postID + "); + $stmt->bindParam(":postID", $postID); + $stmt->execute(); + return $stmt->rowCount(); +} + +function getNietSlechtUsersForPost(int $postID) { + $stmt = $GLOBALS["db"]->prepare(" + SELECT + `fname`, + `lname`, + CONCAT(`user`.`fname`, ' ', `user`.`lname`) as `fullname` + FROM + `user` + INNER JOIN + `niet_slecht` + WHERE + `user`.`userID` = `niet_slecht`.`userID` AND + `niet_slecht`.`postID` = :postID + "); + $stmt->bindParam(":postID", $postID); + $stmt->execute(); + $rows = $stmt->fetchAll(); + foreach ($rows as $row) { + print($row["fullname"]); + } +} \ No newline at end of file