开发者

Friend Module using PHP [closed]

开发者 https://www.devze.com 2023-03-17 20:09 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I am developing a web application in which I have members and I want to add a friends system to this application.

Please help me out with any tutorials or guidelines.

The aim is to say user a and user b are in the system and if user a logs in he should see an add as a friend button; on clicking the button it should display all the users in the system to him and ask if user a would like to to add them as friends and when the friend request is sent and the corresponding开发者_JAVA技巧 user accepts it he should be shown in the user a's friend list.


There's no tutorial for such functionality. It's called knowledge.

I'm not going to give you the complete solution but some tips that will allow you to create it.

You need to store all informations in database - it's obvious. Design of the tables is up to you, but let's say you have something like that, table called friendship:

UserID INT(10)
FriendID INT(10)

Of course you need to take care about relations on your own. So, in our model we have following situation:

  • UserA send a request to UserB
  • UserB is able to accept or reject request sent by UserA
  • When request is accepted you need to store such information in database
  • I saw multiple approaches in this case. Everything depends on your database design and your code

Without knowing anything about your app, we're able to tell you nothing. Creating such functionality isn't hard and I'll call it beginner task however it might be confusing for newbies sometimes.

With the tips provided you'll be able to do so without any problems.

0

精彩评论

暂无评论...
验证码 换一张
取 消