If $userid
equals $row['RequestRecipientID']
then the script will output all $row['StatusType']
which equals "Accepted". What I'm needing for this script to do is only output the $row['StatusType']
which equals to the $userid
. Any ideas?
<?php
include("enc.php");
mysqlcon();
$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");
while($row = mysql_fetch_array($results)) {
if ($userid == $row['RequestRecipientID']) {
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") {
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" name="denied" type="submit" value="Deny" />';
echo '<input type="hidden" name="id" value="' . $row["id"] . '" />';
echo '</form>';
}
}
}
?>