End of day

This commit is contained in:
Marijn Jansen
2017-01-31 16:11:03 +01:00
parent 2a37b9c64d
commit eb094858b5
4 changed files with 50 additions and 35 deletions

View File

@@ -97,20 +97,28 @@ function selectCommentsByPostId($postID) {
return $stmt;
}
function makePost($userID, $groupID, $title, $content) {
function makePost($userID, $title, $content, $groupID = null) {
$picturePath = null;
print_r($_FILES);
if (array_key_exists("picture", $_FILES)) {
$picturePath = uploadPostPicture($userID);
}
echo "Hallo!";
$stmt = prepareQuery("
INSERT INTO
`post` (
`author`,
`groupID`,
`title`,
`content`
`content`,
`image`
)
VALUES (
:userID,
:groupID,
:title,
:content
:content,
:image
)
");
@@ -118,6 +126,7 @@ function makePost($userID, $groupID, $title, $content) {
$stmt->bindParam(':groupID', $groupID);
$stmt->bindParam(':title', $title);
$stmt->bindParam(':content', $content);
$stmt->bindParam(':image', $picturePath);
$stmt->execute();
}