#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    2
    Rep Power
    0

    I want to develop friend request system


    hi all i want to develop a friend system where

    if user A is Logged in and on user B's profile.If A wants to send Friend Request to B the page will show

    Add as friend Cancel Request

    and if B is on A's Profile page he will see

    Accept Request Decline Request

    But i don't know to to code it properly. I tried below code but it is not satisfying results

    <?php
    $addFriend = "";
    $cancelRequest = "";
    $unFriend = "";
    $acceptRequest = "";
    $declineRequest ="";
    $querToCheck = mysql_query("SELECT * FROM friends WHERE (user_one = '$activeID' AND user_two = '$fid') OR (user_one = '$fid' AND user_two = '$activeID' ) ");

    if(mysql_num_rows($querToCheck) > 0) {
    $row = mysql_fetch_array($querToCheck);
    $accepted = $row['accepted'];
    if($accepted == 1) {
    $addFriend = "Pending Approval";
    $cancelRequest = "Cancel Request";
    } else if($accepted == 2) {
    $addFriend = "Friends";
    $unFriend = "Un-Friend";
    } else {
    $addFriend = "Add As Friend";
    }
    } else {
    $acceptRequest = "Accept";
    $declineRequest ="Decline";
    }
    ?>
  2. #2
  3. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,143
    Rep Power
    9398
    Looks like you define some variables there. Are you using them anywhere?
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    2
    Rep Power
    0

    yea


    Originally Posted by requinix
    Looks like you define some variables there. Are you using them anywhere?
    yes, i'm using them in middle of table
  6. #4
  7. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,143
    Rep Power
    9398

IMN logo majestic logo threadwatch logo seochat tools logo