new friends.php
Virker ikke, viser intet.unknown
php
3 years ago
1.6 kB
62
Indexable
Never
<?php $receiverid = $UsersID; $senderid = $UsersID; if (isset($_GET['friends_page'])) { $friends_page = $_GET['friends_page']; } else { $friends_page = 1; } $no_of_records_per_page = 12; $offset = ($friends_page-1) * $no_of_records_per_page; $total_pages_sql = "SELECT COUNT(DISTINCT(id)) AS entries FROM `friends` AS pt WHERE `receiver_accept` != 1 AND (`senderid` = '" . $UsersID . "' OR `receiverid` = '" . $UsersID . "')"; $result = mysqli_query($campist,$total_pages_sql); $total_rows = mysqli_fetch_array($result)[0]; $total_pages = ceil($total_rows / $no_of_records_per_page); $entries = $total_rows["entries"]; if ($entries > 0): $stmt = $campist->prepare("SELECT i.*, t.nickname AS sendername, t.photo AS sbilled, t1.nickname AS receivername, t1.photo AS rbilled, t.online AS senderOnline, t1.online AS rOnline, t.last_seen, t1.last_seen friends i JOIN users_information t on t.profileID = i.senderid JOIN users_information t1 on t1.profileID = i.receiverid WHERE senderid = ? OR receiverid = ? ORDER BY id ASC LIMIT $no_of_records_per_page OFFSET " . ($friends_page-1) * $no_of_records_per_page); $stmt->bind_param("si", $senderid,$receiverid); $stmt->execute(); $stmt->store_result(); if($stmt->num_rows === 0) exit('No rows'); $stmt->bind_result($id, $senderid, $receiverid); while($stmt->fetch()) { $senderid[] = $senderid; $receiverid[] = $receiverid; } else: ?> <strong><?php echo $UsersNickname; ?></strong> har ingen venner. <?php endif; $stmt->close(); ?>