What I need the following code do to is if userid == requestRecipientID display all friend requests that match. what it's doing is if one userid == requestRepientID matches, it displays all requests to all users. Any ideas?
$userid = $_SESSION['userid'];
$results = mysql_query("SELECT requests.RequestRecipientID, requests.StatusType, requests.AddedMessage, requests.FriendType, requests.RequestSentByID, requests.id, users.username, users.firstname, users.lastname, users.email, users.user_pid, users.id FROM requests, users WHERE requests.RequestRecipientID = '$userid'");
while($row = mysql_fetch_array($results)) {
if ($row['StatusType'] == "Accepted") {
echo $row['firstname'] . "has accepted your friend request."; // place inside notification pane
} elseif ($row['StatusType'] == "Denied") {
echo $row['RequestSentByID'] . " has denied your request.";
} elseif ($row['StatusType'] == "Pending" && $row['RequestRecipientID'] == $userid) {
echo "<span class='text1'>";
echo $row['firstname'] . " " . $row['lastname'] . "<br>" . $row['AddedMessage'] . "</span>";
echo "<form method='GET' action='protected/process-friend-request-action.php?" . $row['id'] . "'>";
echo '<input class="action_button" name="accepted" type="submit" value="Accept" />';
echo '<input class="action_button"ss name="denied" type="submit" value="Deny" />';
echo '<input type="hidden" name="id" value="' . $row["id"] . '" />';
echo '</form>';
}
}