Chat is now only loading the last 100 messages

This commit is contained in:
Lars van Hijfte
2017-02-03 00:24:38 +01:00
parent ab21226925
commit 6d739a4480

View File

@@ -6,18 +6,23 @@ function getOldChatMessages($user2ID) {
if (getFriendshipStatus($user2ID) == 1) {
$stmt = prepareQuery("
SELECT
*
*
FROM
`private_message`
WHERE
`origin` = :user1 AND
`destination` = :user2 OR
`origin` = :user2 AND
`destination` = :user1
(SELECT
*
FROM
`private_message`
WHERE
`origin` = :user1 AND
`destination` = :user2 OR
`origin` = :user2 AND
`destination` = :user1
ORDER BY
`messageID` DESC
LIMIT
100) sub
ORDER BY
`creationdate` ASC
LIMIT
100
`messageID` ASC
");
$stmt->bindParam(":user1", $user1ID);
@@ -76,7 +81,7 @@ function getNewChatMessages($lastID, $destination) {
`destination` = :user1) AND
`messageID` > :lastID
ORDER BY
`creationdate` ASC
`messageID` ASC
");
$stmt->bindParam(':user1', $_SESSION["userID"]);