Files
WebDB/website/queries/friendship.php
Lars van Hijfte b71cf36798 Fixed chat
It now has a userID again,
displays which user you are chatting withhover over user changes different background
2017-01-19 11:08:55 +01:00

31 lines
793 B
PHP

<?php
require("connect.php");
function selectAllFriends($db, $userID) {
$stmt = $db->prepare("
SELECT
`userID`,
`username`,
IFNULL(
`profilepicture`,
'img/notbad.jpg'
) AS profilepicture,
`onlinestatus`,
`role`
FROM
`user`
INNER JOIN
`friendship`
WHERE
(`friendship`.`user1ID` = :userID AND
`friendship`.`user2ID` = `user`.`userID` OR
`friendship`.`user2ID` = :userID AND
`friendship`.`user1ID` = `user`.`userID`) AND
`role` != 5 AND
`status` = 1
");
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
$stmt->execute();
return $stmt;
}