Changed select posts query.
This commit is contained in:
@@ -68,18 +68,24 @@ function selectAllUserGroups($userID) {
|
|||||||
function selectAllUserPosts($userID) {
|
function selectAllUserPosts($userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
`postID`,
|
`postID`,
|
||||||
`author`,
|
`author`,
|
||||||
`title`,
|
`title`,
|
||||||
`content`,
|
CASE LENGTH(`content`) >= 150
|
||||||
`creationdate`
|
WHEN TRUE THEN
|
||||||
|
CONCAT(LEFT(`content`, 150), '...')
|
||||||
|
WHEN FALSE THEN
|
||||||
|
`content`
|
||||||
|
END
|
||||||
|
AS `content`,
|
||||||
|
`creationdate`
|
||||||
FROM
|
FROM
|
||||||
`post`
|
`post`
|
||||||
WHERE
|
WHERE
|
||||||
`author` = :userID AND
|
`author` = :userID AND
|
||||||
`groupID` IS NULL
|
`groupID` IS NULL
|
||||||
ORDER BY
|
ORDER BY
|
||||||
`creationdate` DESC
|
`creationdate` DESC
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
||||||
|
|||||||
Reference in New Issue
Block a user