Changed select posts query.

This commit is contained in:
K. Nobel
2017-01-24 16:40:30 +01:00
parent 6314494177
commit f9f1e2bf17

View File

@@ -68,18 +68,24 @@ function selectAllUserGroups($userID) {
function selectAllUserPosts($userID) {
$stmt = $GLOBALS["db"]->prepare("
SELECT
`postID`,
`author`,
`title`,
`content`,
`creationdate`
`postID`,
`author`,
`title`,
CASE LENGTH(`content`) >= 150
WHEN TRUE THEN
CONCAT(LEFT(`content`, 150), '...')
WHEN FALSE THEN
`content`
END
AS `content`,
`creationdate`
FROM
`post`
`post`
WHERE
`author` = :userID AND
`groupID` IS NULL
`author` = :userID AND
`groupID` IS NULL
ORDER BY
`creationdate` DESC
`creationdate` DESC
");
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);