Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6731073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:29:05+00:00 2026-05-26T10:29:05+00:00

If $userid equals $row[‘RequestRecipientID’] then the script will output all $row[‘StatusType’] which equals Accepted.

  • 0

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>';
    }
    }
}
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:29:05+00:00Added an answer on May 26, 2026 at 10:29 am

    If you only need results that is related to a userid you should first filter using SQL query.

    // Assuming that your SQL query is correct
    // added WHERE users.RequestRecipientID = '$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 users.RequestRecipientID = '$userid'");
    
    // used fetch_assoc instead of fetch_array since you are 
    // not using numeric array
    while($row = mysql_fetch_assoc($results)) {
        // normally 3 is my limit to use if-else
        // if i have more than 3, i'll use switch
        if ($row['StatusType'] == "Accepted") {
            // accepted action
        }
        elseif ($row['StatusType'] == "Denied") {
            // denied action
        }
        else {
            // not denied & accepted action
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to pass a userId (string) in the URL which will be passed
I've inherited a mobile app which sends auth credentials (userid/password) in the clear. I'd
public MyClass(Integer userId, Integer otherId) { if(!userId.equals(otherId)){ this.userId = userId; this.otherId = otherId; }
Table: UserId, Value, Date. I want to get the UserId, Value for the max(Date)
How can I access UserId in ASP.NET Membership without using Membership.GetUser(username) in ASP.NET Web
I have a table UserAliases ( UserId, Alias ) with multiple aliases per user.
I have tables like this: tblUsers int UserID string UserName tblUsersInRoles int UserID int
I have three tables: User: UserId (pk) FirstName Lastname Messages: MessageId (pk) Heading Body
So I have a database schema like this: Users UserId RoleUserXRef RoleUserId RoleId UserId
I have a postgres database with a user table (userid, firstname, lastname) and a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.