+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 17
Like Tree1Likes

Thread: Add friend script

  1. #1
    gdebojyoti.mail96 is offline x10Hosting Member gdebojyoti.mail96 is an unknown quantity at this point
    Join Date
    Mar 2011
    Posts
    57

    Question Add friend script

    Hello everyone,

    I want to introduce the concept of "adding friends" in my website. But I am not sure about how to start. That is, how I should design the SQL table, algorithm, etc...

    Only "friends" will have certain privileges (like posting comments, receiving updates, etc).

    Please note that the code will be in PHP.

    Looking forward to your tips.

    Regards.

  2. #2
    gdebojyoti.mail96 is offline x10Hosting Member gdebojyoti.mail96 is an unknown quantity at this point
    Join Date
    Mar 2011
    Posts
    57

    Re: Add friend script

    Please reply.

  3. #3
    emoticonllc18 is offline x10Hosting Member emoticonllc18 is an unknown quantity at this point
    Join Date
    Jul 2011
    Posts
    5

    Re: Add friend script

    Are you a novice PHP programmer. If so I would recommend the following. 1) Download MySQL Workbench from http://www.mysql.com. This will provide you with a visual tool for create the necessary database tables. 2) Install Propel, Phing and Log from PEAR. These software packages will give you a comfortable way of interfacing with the database that you create with MySQL Workbench..

    If you are unsure as how to create your database. Consider the following each table must contain an "id" column. This is an automatically incremented numeric column (by MySQL). You will use the "id" column in multiple tables to "relate" records to each other e.g., customers to orders.

    If you give me an idea of what your skill level is I can better help you. If this is too technical already I would recommend starting with a PHP CMS like Drupal where you can interactively create what you need and ease yourself into PHP.
    Last edited by emoticonllc18; 08-29-2011 at 11:30 AM.
    gdebojyoti.mail96 likes this.

  4. #4
    gdebojyoti.mail96 is offline x10Hosting Member gdebojyoti.mail96 is an unknown quantity at this point
    Join Date
    Mar 2011
    Posts
    57

    Re: Add friend script

    No, I am not a novice. I have been coding in PHP for the past 8 months. And I am quite familiar with MySQL and interfacing with databases.

    Actually, I am trying to create a social networking site of my own from scratch; like Facebook or Twitter. And I wanted know about designing the friends part of the database. That is, what columns (e.g.: userID, friendID, relationID) I should create, etc. And how it would affect their privileges (like 'commenting', 'getting notifications').
    Later, I would also introduce friend groups and other related aspects. So I need to design this particular part of the database now, so as to avoid problems in the future.

    I hope that you have now understood my question. Do let me know if something is not clear.

    Looking forward to your answer.

  5. #5
    divinemamgai70's Avatar
    divinemamgai70 is offline x10Hosting Member divinemamgai70 is an unknown quantity at this point
    Join Date
    Jun 2011
    Location
    India
    Posts
    2

    Re: Add friend script

    Hi buddy, I think you should use PHP, Ajax and somewhat Javascript for this purpose. And not to mention, you had to have some knowledge about MySQL because it is the prime code for this purpose. I think you need some tutorials to begin with, so here is a simple link.

  6. #6
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: Add friend script

    Add another table, friendships. Two columns member_id and friend_id where member_id is the one who made friend_id a friend. Primary index on the combination of the two cols. Index on each column too.

    If member 223 wants to comment on member 456, you check to see if you have an entry with member_id=456 and friend_id= 223 . That is, if you want only friends to comment (or do X). If you want the user to decide (ie anybody can comment, only friends, nobody) you would have to check with your user table first.
    Nothing is always absolutely so.

  7. #7
    gdebojyoti.mail96 is offline x10Hosting Member gdebojyoti.mail96 is an unknown quantity at this point
    Join Date
    Mar 2011
    Posts
    57

    Re: Add friend script

    I did not understand this part:

    Quote Originally Posted by descalzo View Post
    Primary index on the combination of the two cols. Index on each column too.
    What do you mean by "primary index on the combination"?

    Thanks for your inputs, by the way.

    ---------- Post added at 06:19 PM ---------- Previous post was at 06:17 PM ----------

    Quote Originally Posted by divinemamgai70 View Post
    Hi buddy, I think you should use PHP, Ajax and somewhat Javascript for this purpose. And not to mention, you had to have some knowledge about MySQL because it is the prime code for this purpose. I think you need some tutorials to begin with, so here is a simple link.
    I shall be using Ajax after having constructed a basic version of my website.
    Thanks for the info source, though.

  8. #8
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: Add friend script

    You use a clause: PRIMARY KEY (member_id, friend_id) in your table definition.
    Nothing is always absolutely so.

  9. #9
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Add friend script

    Experience isn't solely a matter of time; quality of experience counts for much. What's your understanding of the relational model? It's crucial in modeling objects in the solution domain.

    The first step in any development project is to define the problem (is friendship a symmetric relationship? Does friendship confer anything else other than special privileges? &c.). Then define the requirements to keep you on-track, so you know that, when you've finished, you've met your goals. Behavior driven development can also help you to keep focus.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  10. #10
    emoticonllc18 is offline x10Hosting Member emoticonllc18 is an unknown quantity at this point
    Join Date
    Jul 2011
    Posts
    5

    Wink Re: Add friend script

    If you are wanting to get up and running quickly consider installing Word Press from http://www.wordpress.org. It is a PHP / MySQL driven application that is a perfect example of what you are trying to accomplish. Just review the source code. You know PHP. Word Press is not a complicated database schema so you should be okay. Otherwise, you need to start with the database design basics-- here is a good tutorial: http://www.databaseprimer.com/relationship_1tox.html

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Help my friend please :)
    By 3dhomejoe in forum Off Topic
    Replies: 0
    Last Post: 10-25-2010, 11:09 PM
  2. referral friend script problem
    By relisys in forum Scripts & 3rd Party Apps
    Replies: 5
    Last Post: 08-14-2008, 06:30 PM
  3. hello! new friend
    By hotstar in forum Introductions
    Replies: 0
    Last Post: 11-01-2006, 05:17 AM
  4. Tell a Friend
    By o0slowpaul0o in forum Tutorials
    Replies: 1
    Last Post: 06-16-2005, 05:36 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers