Jump to content

not sure what you would call this...


stelthius

Recommended Posts

Hi guys,

 

Basicly i have built a login system with search members feature and when you go to testers profile you will see "Add as a friend" click it to add them, but say you searched for your own account and you clicked your profile the "Add as a friend" button wouldnt show, need a little help working this one out as im unsure what the function is actually called.

 

 

Regards Rick

Link to comment
Share on other sites

You'd check their user ID number (which could be stored in a session variable) and check it with the profile they're viewing.  If it matches don't display "Add Friend" button/link.

 

You could also go one step further and check if the friend link exists. If it does, don't display "Add Friend" but add "Remove Friend" instead.

Link to comment
Share on other sites

Let's say your user id is logged in a session when you're logged in, and this is the code for your add friend list;

 

<?php
//database connection needed
$query = "SELECT id, username FROM yourusertable";
$result = mysql_query($query) or die(mysql_error());
while($row=mysql_fetch_assoc($result)){
if($row['id'] != $_SESSION['logged_id']){
echo "<a href="addfriend.php?friendid={$row['id']}">{$row['username']}</a>";
}
}
?>

 

Just substitute your code :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.